One other way to think about this - you shouldn't need to nest
resources more then one level deep.

You only deal with children in relation to parents and dogs in
relation to children. Separate relationships which can be handled
transparently. Plus the links you have to generate get a lot more
confusing - parents_childrens_dog_path( parent_id, child_id, dog_id)
or some such...

On Sep 20, 1:41 pm, mlittle <mdlit...@gmail.com> wrote:
> MichaelB:
>
> THANK YOU!!!!! So much. Your solution fixed my problem and taught me a
> bunch about rails.
>
> Thanks again for your help.
>
> On Sep 20, 8:32 am, MichaelB <michael.james.bamf...@gmail.com> wrote:
>
> > Hey mlttle-
>
> > You can create a new dog with:
>
> > def create
> >   @dog = Parent.find(params[:parent_id]).children.find(params
> > [:child_id]).dogs.create
> > end
>
> > The console is your best friend to quickly diagnose errors:
>
> > >> @record= parent.child.dog.build(params[:dog])
>
> > NoMethodError: undefined method `child' for #<Parent:0x22b6748>
>
> > .. becuase your parent model has many **children**
>
> > >> @record= parent.children.find(child).dogs.build(params[:dog])
>
> > Michael
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to