ruby - How do you get my rails radio_button_tag to save the data on form submission? -


i newer rails , thought add radio button set form enforce user choice. able form loaded , select 1 of options, upon posting via submit button model error field needing present (something wanting validate). below form code radio buttons.

<div class="field">   <div>   <%= f.label "type" %>   </div>   <div class="radio-inline">     <%= radio_button_tag :ptype, "question" %><%= label_tag :ptype_question, 'question' %>   </div>   <div class="radio-inline">     <%= radio_button_tag :ptype, "problem" %><%= label_tag :ptype_problem, 'problem' %>   </div>   <div class="radio-inline">     <%= radio_button_tag :ptype, "idea" %><%= label_tag :ptype_idea, 'idea' %>   </div>   <div class="radio-inline">     <%= radio_button_tag :ptype, "praise" %><%= label_tag :ptype_praise, 'praise' %>   </div> </div></br> 

i've whitelisted :ptype in params within controller, know isn't issue, , when make field plain text_field able submit fine, thinking messed multiple options, haven't quite been able figure out after checking few other posts.

i noticed getting data in logging, isn't indented other elements are:

--- !ruby/hash:actioncontroller::parameters utf8: "✓" authenticity_token: 7uaq/wx4... post: !ruby/hash:actioncontroller::parameters   title: packers   content: rock!   category: football ptype: question commit: post controller: posts action: create 

again, thinking it's simple fix since text_field posts fine, still new figure out quite wrong. in advance!

apply form object radio button this:

f.radio_button 

it submit without mess.


Comments