ruby on rails - Nested Resources Post Issue -


i have rails 4 application has 2 scaffolds (that same default generate). have routes.rb looks this:

resources :companies    resources :peoples end 

until added nested routes, 2 scaffolds worked alone. when added nested routes, when visit route like:

http://localhost:3000/companies/bobs-pizza/peoples/new 

and fill out peoples form , submit, error like:

routing error no route matches [post] "/companies/bobs-pizza/peoples/new" 

my _form.html.erb peoples scaffold ( child in relationship between peoples , companies) changed this:

<%= form_for companies_path(@company,@people) |f| %> 

thanks help.

run rake routes , ensure companies_path correct route need.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -