Reputation: 52540
I have a nested resource in my routes.rb
file:
resources :users do
resources :children
end
I have a form at /users/:id/children/new
. Form comes up fine and the embedded ruby for the form looks like this:
<%= form_for(@user) do |f| %>
Problem is I want this to submit to /users/:id/children
, but it submits to /users
. Is there a standard way this should be done in Rails?
Upvotes: 0
Views: 185
Reputation: 1149
The embedded form shold look like this
<%= form_for [@user, Children.new] do |f|%>
<%= f.label :children_attr,.....%>
.
.
see this vedio, it might help.
Upvotes: 1