When I click the 'New Schedule Status' button on the 'Project' show page, but the route that the error shows me is plural, when it should be singular. Here's my code:
# project.rb
class Project < ActiveRecord::Base
has_one :schedule_status
end
# schedule_status.rb
class ScheduleStatus < ActiveRecord::Base
belongs_to :project
end
# schedule_statuses_controller.rb
def new
@project = Project.find(params[:project_id])
@schedule_status = @project.build_schedule_status
end
# routes.rb
resources :projects do
resource :schedule_status
end
# _form.html.erb
<%= form_for [@project, @schedule_status] do |f| %>
...
The error informs me that my form_for
line is incorrect. It seems like my instance variables are setup correctly, but the error is:
undefined method `project_schedule_statuses_path` for ...
Any idea why the route it's attempting to access is plural?