I have:
in config/routes.rb
map.resources :projects do |project|
project.resource :privacy
end
end
in models/project.rb
belongs_to :privacy
in models/privacy.rb
has_one :project
in show.html.haml
= change_privacy_button(@project)
in an accessible helper
def change_privacy_button(project)
button_builder("24gray/edit.png", "Edit Privacy Settings", edit_project_privacy_path(project), "change_privacy_settings")
end
This is giving me the following error:
Couldn't find Privacy without an ID (ActiveRecord::RecordNotFound)
The error occurs on:
http://localhost:3000/projects/:id/privacy/edit
Rake routes tells me to use:
edit_project_privacy GET
/projects/:project_id/privacy/edit(.:format)
{:action=>"edit", :controller=>"privacies"}
In the debugger, I can summon:
(rdb:1) project
#<Project id: 1...
(rdb:1) project
#<Project id: 1...
(rdb:1) project.privacy
#<Privacy id: 1...
(rdb:1) edit_project_privacy_path
ActionController::RoutingError Exception: edit_project_privacy_url failed to generate from {:action=>"edit", :controller=>"privacies"} - you may have ambiguous routes, or you may need to supply additional parameters for this route. content_url has the following required parameters: ["projects", :project_id, "privacy", "edit"] - are they all satisfied?
Your thoughts? Thanks! PS, all of the following have also failed:
edit_project_privacy_path(project, project.privacy)
edit_project_privacy_path(project.id, project.privacy)
edit_project_privacy_path(project.privacy_id, project.privacy)
edit_project_privacy_path(project.privacy_id)
edit_project_privacy_path(project.privacy)