欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

select_tag default value & options

程序员文章站 2022-05-25 19:47:38
...
#If you are using select_tag without any other helper, then you can do it in html:

select_tag "whatever", "<option>VISA</option><option selected=\"selected\">MasterCard</option>"

#Or with options_for_select:

select_tag "whatever", options_for_select([ "VISA", "MasterCard" ], "MasterCard")

#Or with options_from_collection_for_select:

select_tag "people", options_from_collection_for_select(@people, 'id', 'name', '1')

#Examples are from select_tag doc, options_for_select doc and from options_from_collection_for_select doc.


相关标签: select_tag