Force Rails path -


i'm new rails, , i'm trying create redmine plugin.

i want "show" path go /projects/:project_id/summary, since normal "show" path, /projects/:project_id/ taken app.

i set route to:

get 'projects/:project_id/summary/', to: 'summaries#show', as:  'project_summary' 

i tested route, , works. however, attempts write link_to fail. can link project/:project_id. don't know how tack on 'summary' path. there way? know route little off rails, , may not permitted. other routes rails approved, i'm hoping can bend rules once...

let's have project id 8, link_to be:

@project = project.find(8) link_to "the project", project_summary_path(@project) 

also, assuming model here project , not summary. if there summary model, need tell how projects , summaries connected in model. if there summary model belongs_to project, need adjust routes to:

get 'projects/:project_id/summaries/:summary_id', to: 'summaries#show', as: 'project_summary' 

and link_to this:

@project = project.find(8) @summary = summary.find(10) #assuming id of summary 10 link_to "the project", project_summary_path(@project, @summary) 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -