Reputation: 1848
I'm trying to construct a Link. The resulting Link should look something like this:
http://localhost:3000/re_goal/edit/2
This is what I came up with:
<%= @issue.re_artifact_properties.collect { |properties| link_to properties.name, re_goal_path()}.to_sentence %>
It now says that i may have ambiguous routes.
content_url has the following required parameters: ["projects", :project_id, "re_goal", :id]
But if i pass the project_id as an option, the constructed link looks something like this:
http://localhost:3000/projects/1/re_goal/1
Does any1 has an idea on how to construct the correct link?
Thanks,
Nico
Upvotes: 1
Views: 214
Reputation: 1359
Looks like you've got a nested route being generated there. Either supply the required params, or remove the nested route.
Or go for the 'middle way' of shallow routes:
resources :projects, :shallow => true do
resources :re_goal
end
Upvotes: 2
Reputation: 211740
If you have a route that takes parameters, you must supply them. rake routes
can be useful for determining what arguments are required and what order they should be provided in. Your route probably looks like this:
projects/:project_id/re_goal/:id
In this case you will need to provide project_id
and id
as the two arguments to re_goal_path
. If you omit them you get the "required parameters" error. It's not clear from your question how you get a project or a goal from your @issue
, but that's what you need.
Upvotes: 0