Getting controller name from a request.referer in Rails

Keep in mind that request.referrer gives you the url of the request before the current one. That said, here is how you can convert request.referrer to controller/actionn information:

Rails.application.routes.recognize_path(request.referrer)

it should give you something like

{:subdomain => "", :controller => "x", :action => "y"}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)