我有一个嵌套的路由,看起来像这样...
get 'participants/:participant_id/surveys/:survey_id', to: 'surveys#take_survey', as: :take_survey
我的问题是这个。我知道我得到了这样的路径助手,"surveys_path(@survey)"用于这样的路线......
get 'surveys/:id', to: 'surveys#show'
因此,由于在我上面列出的第一条路由中,我设置了一个自定义路径名,该路径名为我提供了帮助程序"take_survey_path"......
如何使用帮助程序"take_survey_path()"检索调查?
基本上。。。"take_survey_path(what_do_I_put_here_to_retrieve_a_survey?"
所以这很简单。
"take_survey_path",因为我为我的嵌套路径设置了它,需要两个参数......
'take_survey_path(participant_id, survey_id)'