Nested resource route helper not working

 ̄綄美尐妖づ 提交于 2019-12-18 04:08:08

问题


I have a nested route like so:

  resources :apps do
    resources :issues
  end

the helper for seeing all issues related to an app is as follows:

app_issues_url(app)

but now I want to use a helper to point to a specific issue of a specific app like apps/1/issues/1 but i don't know how to use that helper. what is the helper for this url?


回答1:


you can pass both instances to url helper like

app_issue_url(@app,@issue)

you can also use

app_issue_path(@app,@issue)

or

url_for([@app,@issue])

see rails doc for more info



来源:https://stackoverflow.com/questions/8207644/nested-resource-route-helper-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!