简体   繁体   中英

Rails select_box with non model attributes

I have problem with select boxes in rails. I have model Page, and in form for it I want to build select box with 2 values that i wll define that are not model attributes. I want this strange thing to can hide with jquery some parts of my form. Is there any way to do it with simple_form or rails form helpers?

您可以使用select_tag帮助程序(请参阅docs ):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM