문제

Right now, I capture http_referrer within each of my controller actions, such as:

class PostsController < ApplicationController
  def new
    referer = request.referer
  end

However, I would like to capture the referer no matter which page use lands on. How should I do that? One idea I have is to override ApplicationController to capture and save it to session. But I am not sure if this is a good way to do it.

Thank you.

도움이 되었습니까?

해결책

add a before_filter in ApplicationController

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top