Model relationships:
class Project < ActiveRecord::Base
...
has_one :project_team
...
end
class ProjectTeam < ActiveRecord::Base
belongs_to :project
end
Controller:
class Project::TeamController < ApplicationController
...
end
Routes:
resources :projects do
namespace :project do
resources :team
end
end
Form code:
= form_for @project do |f|
When I visit the new Project form, I get the following error:
No route matches {:controller=>"project/team", :project_id=>#<Project id: nil, user_id: 1 ...
I’ve tried many variations of this:
= form_for [:project, :team, @project] do |f|
To no avail. The routes are just barely off. But, I’m on the new project form, so I’m wondering why it’s trying to grab the project team for that anyway.
Thanks for the help! [:
I’m not sure of the issue, but to fix it, I just pluralized my controller name.