People,
I have successfully worked my way through this exercise:
https://www.sitepoint.com/save-multiple-checkbox-values-database-rails
(but changing "professors" to "tippers" and "expertises" to "tips" - for
a football tipping app).
Then the only change I made was to: app/views/tippers/_form.html.erb
from:
<div class="field">
<%= f.label "Tip" %><br />
<%= f.collection_check_boxes :tip_ids, Tip.all, :id, :teams do |b| %>
<div class="collection-check-box">
<%= b.check_box %>
<%= b.label %>
</div>
<% end %>
</div>
to:
<div class="field">
<%= f.label "Tip" %><br />
<%= f.collection_radio_buttons( :tip_ids, Tip.all, :id, :teams ) do
|b| %>
<div class="collection-radio-button">
<%= b.label + b.radio_button %>
</div>
<% end %>
</div>
which actually works in the view but unlike the Checkbox version the
data is not saved in the tippers_tips table.
What am I missing?
Thanks,
Phil.
--
Philip Rhoades
PO Box 896
Cowra NSW 2794
Australia
E-mail: phil@pricom.com.au
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7be5d27039e9136ba411320796e1c810%40pricom.com.au.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment