please, take look on https://github.com/HH-project/hh/blob/dev/app/controllers/application_controller.rb#L10