Now i have the country hash ready which is all we need to build a selection list in view.
Rails – Retrieve a Hash from Model
We can create a selection list using the f.select() method. The following view is an example.
<% # Get the countries hash for selection list @countries = Country.hashify %> ... <p><%= f.label :country %><br /> <%= f.select(:country, @countries) %></p> ...
Reference: Rails Guides – Rails Form helpers