how can I display controller's variable (which is on a loop) on .html.erb page? ruby on rails
Posted
by
rrz
on Stack Overflow
See other posts from Stack Overflow
or by rrz
Published on 2012-11-13T16:52:42Z
Indexed on
2012/11/13
17:00 UTC
Read the original article
Hit count: 208
I have the following code listed below in my controller:
struc = {'en' => 'english', 'es' => 'espaniol', 'de' => 'germany', 'fr' => 'french', 'it' => 'italy'}
struc.each_pair do |key, value|
@key=key
@value=value
end
on my application.html.erb I have the following
<select name="Language" onchange="location=this.options[this.selectedIndex].value;">
<option value="/<% @key %>/<%= @rem %>"><%= @value %></option>
</select>
Now how can i make the value of '@key' and '@value' appear recursively display on (application.html.erb)?
Thanks in advance
© Stack Overflow or respective owner