routes.rbをにすべきで、私が持っている:それはない場合は、ユーザーがログインして、偽されている場合一つの一致したルートは、別のものを上書きしますが、ない
[some routes]
match '/me' => "scores#all_athlete_scores", :constraints => LoggedInChecker
devise_scope :user do
match '/me' => "devise/sessions#new"
end
match '/scores/athlete/:id', :to =>"scores#all_athlete_scores", :as => "all_athlete_scores"
[some more routes]
LoggedInCheckerはtrueを返します。 falseの場合、2番目のルートはそれを取得し、ユーザーをログインページに送ります。 scores_controller_test.rbで
、私は:[:full_path] scores_controller_testに/[email protected]ある、ない/スコア/アスリート/
def test_get_all_athlete_scores
[set up]
get :all_athlete_scores, :id => @user
end
を奇妙な部分がrequest.filtered_parametersことです:id '。
私があるとroutes.rbを変更する場合:
[some routes]
match '/scores/athlete/:id', :to =>"scores#all_athlete_scores", :as => "all_athlete_scores"
match '/me' => "scores#all_athlete_scores", :constraints => LoggedInChecker
devise_scope :user do
match '/me' => "devise/sessions#new"
end
[some more routes]
テストが正常に動作し、request.filtered_parameters [:full_path] = /スコア/アスリート/:ID。
all-atlete_scoresにGETを行ったときに、この/ - 私は完全に邪魔されるべきではありません。
アイデア?
うん、そうだ。ありがとう! – kareem