I have nested resources 2 levels deep and am having problems with the
controller of the deepest resource;

Parent > Child > Dog

The rails guide says this for the forms, which seems to work fine:

form_for [:parent, :child, @dog]

I have all the appropriate belong_to and has_many but I cannot figure
out how to do this in the dog controller:

def create
parent = Parent.find(params[:parent_id])
child = Child.find(params[:child_id])
@record= parent.child.dog.build(params[:dog])
.....
end

I am getting this error: undefined method `child'
--~--~---------~--~----~------------~-------~--~----~
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