Register your hook method which is invoked before invoking render method.
Add this line to your application's Gemfile:
gem'before_render'And then execute:
$ bundle
Or install it yourself as:
$ gem install before_render
classSomeController < ApplicationControllerbefore_render:my_hooker_before_render,only: [...]defmy_hooker_before_render# Invoked before render method.endendBug reports and pull requests are welcome on GitHub at https://github.com/toshiyukihina/before_render.
The gem is available as open source under the terms of the MIT License.