1

Inside my controller, I want to know how can I get the URL that calls my controller?

Steve Ng
  • 1,189
  • 1
  • 13
  • 35
  • http://guides.rubyonrails.org/routing.html#path-and-url-helpers –  Aug 14 '13 at 14:53
  • and possible duplicate with [http://stackoverflow.com/questions/2165665/how-do-i-get-the-current-url-in-ruby-on-rails](http://stackoverflow.com/questions/2165665/how-do-i-get-the-current-url-in-ruby-on-rails) – epsilon Aug 14 '13 at 14:54
  • @jbh that question is about the current URL, I am asking for the calling URL – Steve Ng Aug 14 '13 at 14:58
  • @SteveNg You mean the referrer ? http://stackoverflow.com/questions/8071913/rails-3-get-request-referrer – Baldrick Aug 14 '13 at 15:02

1 Answers1

1

You can use

request.env['HTTP_REFERER']

or

request.referer
Santhosh
  • 28,097
  • 9
  • 82
  • 87