Hi guys! I''m having this trouble over relationships between models, like this: Venue (read a student''s tests) ---> Assignment ---> Sheet (read musical sheets) Here''s a video of what I need to accomplish: http://screenr.com/RQl It''s pretty straightforward, I believe: when creating venues, I want to associate sheets to the test, so the student knows what he has to practice for it; through simple checkboxes. Is this achievable with accepts_nested_attributes_for? i''m not sure how to solve this problem and I appreciate your help in enlightening me on this. Thanks for helping, guys! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Whipped up a small plugin for your use case: http://github.com/Erol/nested_checklist In your Venue model: has_many :assignments has_many :sheets, :through => :assignments accepts_nested_checklist_and_attributes_for :sheets In your VenuesController: def new @venue = Venue.new @venue.build_sheets_checklist end def edit @venue = Venue.find(params[:id] @venue.build_sheets_checklist end Then use nested forms in your views: <% form_for @venue do |v| %> <% v.fields_for :sheets do |vs| %> <%= vs.check_box :checked_for_venue %> <%= vs.label vs.object.name %> <% end %> <%= v.submit %> <% end %> I made the plugin rather quickly so I can not guarantee that it works 100%, and there are no test cases. If you find any bugs, just message me. HTH On Fri, Oct 15, 2010 at 3:19 AM, José Mota <josemota.net-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi guys! I''m having this trouble over relationships between models, > like this: > > Venue (read a student''s tests) ---> Assignment ---> Sheet (read > musical sheets) > > Here''s a video of what I need to accomplish: http://screenr.com/RQl > > It''s pretty straightforward, I believe: when creating venues, I want > to associate sheets to the test, so the student knows what he has to > practice for it; through simple checkboxes. Is this achievable with > accepts_nested_attributes_for? i''m not sure how to solve this problem > and I appreciate your help in enlightening me on this. > > Thanks for helping, guys! > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Erol M. Fornoles http://github.com/Erol http://twitter.com/erolfornoles http://ph.linkedin.com/in/erolfornoles -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''ll go test it and let you know, Erol. Thanks for the kind help. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hmmm okay looks like it''s bugged when the controller action is edit. Give me a few to fix this. On Fri, Oct 15, 2010 at 4:31 PM, José Mota <josemota.net-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ll go test it and let you know, Erol. Thanks for the kind help. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Erol M. Fornoles http://github.com/Erol http://twitter.com/erolfornoles http://ph.linkedin.com/in/erolfornoles -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Commited possible fix. Just pull the updates. On Fri, Oct 15, 2010 at 4:49 PM, Erol Fornoles <erol.fornoles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Hmmm okay looks like it''s bugged when the controller action is edit. Give > me a few to fix this.-- Erol M. Fornoles http://github.com/Erol http://twitter.com/erolfornoles http://ph.linkedin.com/in/erolfornoles -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.