How can I display all the environment variables on an HTML page using Rails? -


i have bunch of environment variables set on windows machine display on html page. able display 1 not sure how loop , display of them key-value pairs.

please guide.

rails version: 4.2

environment variables:

my_encoding_scheme: utf8 db_conn_pool: 10 db_user_name: guest db_pwd: secret 

index.html.erb

<div class="table-container">   <table class="table">     <thead>     <tr>       <th colspan="2">environment variables</th>     </tr>     </thead>     <tbody>         <tr><td><%= env["my_encoding_scheme"] %></td></tr>     </tbody>   </table> 

you loop through environment variables this

<table>   <thead><tr><td>variable</td><td>value</td></tr></thead>   <tbody>     <% env.each |k,v| %>       <tr><td><%= k %></td><td><%= v %></td></tr>     <% end %>   </tbody> </table> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -