$request = request
When I write this in controller, it will work. But if i need this variable in Model or Application controller, How can i ?
For Rails 5, you need to use before_action instead.
before_action