In the application controller before filter.
class ApplicationController < ActionController::Base before_filter :authenticate def authenticate # How
You can get full url object using
url = Rails.application.routes.recognize_path(request.env['PATH_INFO'])
now you can get components as
url[:controller]
url[:action]
By default you can also use params[:controller] and params[:action] respectively during request/response life cycle.
params[:controller]
params[:action]