Hello,
A have a hash-table with countries in it like this:
@countries = {'United States' => 'US', 'France' => 'FR'}
and I use the following code to display it in a select box:
<%= select_tag 'countries',
options_for_select(@countries.to_a) %>
Now when it saves data in my table I got in my row US, UK...and so on, now the problem is when I want to output data, so instead of US I would like to output 'United States' I use:
<%=h @countries[@offer.from_country] %>
But the first hash-table cannot work and I have to reverse the order and use:
@countries = {'US' => 'United States', 'FR' => 'France'}
Any ideas on how to have the same hash-table for both displaying the data in the select box, and then on the show page?