Railsで遷移元のURLの取得
遷移元によって、処理を変えたいことがあったのでメモ。
遷移元のURL取得
request.referer
遷移元のcontroller名、action名は
Rails.application.routes.recognize_path(request.referrer) => {:controller => "hoge", :action => "index"}
てな感じで取得できる☆
遷移元によって、処理を変えたいことがあったのでメモ。
遷移元のURL取得
request.referer
遷移元のcontroller名、action名は
Rails.application.routes.recognize_path(request.referrer) => {:controller => "hoge", :action => "index"}
てな感じで取得できる☆