开发者

How to generate a select box by using options_from_collection_for_select

开发者 https://www.devze.com 2022-12-18 18:10 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消