ruby on rails - ActiveRecord::RecordNotFound in ContactsController#create Couldn't find Company without an ID error -
when try submit @ localhost:3000/companies/1/contacts/new error couldn't find company without id https://gist.github.com/overhang/f8c20d2d2c851cdee7b1 clue? reckon might problem routes.rb
remove following lines routes.rb
# config/routes.rb # "companies/index" # "companies/new" # "companies/show" # "companies/create" # "companies/edit"
notice restful controller actions edit
, show
require specific company
passed in order correct company looked up. these get
routes don't allow that. instead, should utilizing resource routes you've already
created:
# config/routes.rb resources :companies
the non-resourceful routes impeding execution of resourceful ones. removing them should fix problem.
Comments
Post a Comment