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