Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
708 views
in Technique[技术] by (71.8m points)

ruby on rails - Nested resource route helper not working

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...