How to generate a select box by using options_from_collection_for_select
I am really confused with select boxes in ROR. How can I generate a working select box by using options_from_collection_for_select. This wi开发者_Python百科ll only generate the option tags and not the select tag? Can anyone please provide me an example on how to use this.
I am having a hard time understanding select boxes, I don't know why...
Thanks
<% options = options_from_collection_for_select(@awesome_options, 'id', 'name') %>
<%= f.select :awesome_column, options %>
If you could give a little more insight into the error you are getting, we might be able to provide you with a better answer, but I believe the above is the basic gist of options_from_collection
.
精彩评论