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.
上一篇: 字体图标网站---常用汇总
下一篇: 浏览器判断
推荐阅读
-
php警告Creating default object from empty value 问题的解决方法_php技巧
-
php警告Creating default object from empty value 问题的解决方法
-
【MySql】Mysql ERROR 1067: Invalid default value for ‘date’ 解决
-
MySQL添加用户错误:ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value解决方法
-
Field 'id' doesn't have a default value错误解决方法
-
[VUE ERROR] Invalid default value for prop "slides": Props with type Object/Array must use a factory function to return the default value
-
php警告Creating default object from empty value 问题的解决方法
-
ERROR: Field 'PostId' doesn't have a default value Exception in thread "main" org.hibernate.exception.GenericJDBCException: coul
-
[MySQL] BLOB, TEXT, GEOMETRY or JSON column 'body' can't have a default value错误
-
解决Mysql报Invalid default value for ''operate_time''错误的问题