0
如何從form_for helper獲取單選按鈕的值?Rails - 如果選中單選按鈕,則添加類
使用SLIM。
=form_for(@foo) do |f|
label[class="#{ f.type.value == 'type 1'? 'foo' : 'bar'}"]
| Type 1
= f.radio_button :type, 'Type 1'
label[class="#{ f.type.value == 'type 2'? 'foo' : 'bar'}"]
| Type 2
= f.radio_button :type, 'Type 2'
犯規存在的值的方法。如何訪問表單助手的無線電方法的價值?
你讀過了Rails的文檔? – emaillenin
@emaillenin沒有提及訪問值[Rails](http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-radio_button_tag) –
任何人?..真的需要這個.. –