以下是我在视野中使用的内容:
select_tag "credit_card", options_for_select([ "VISA", "MasterCard" ], "MasterCard")
我正试图在控制器中访问
selected_card=params[:credit_card]
这是我用来访问文本框值的方式。
答案 0 :(得分:2)
尝试:
select_tag "credit_card", options_for_select([ "VISA", "MasterCard" ], params[:credit_card])