In my use case I need to factor rendering logic whose behaviour is conditioned by some values computed on the action:
class StatisticsController < ApplicationController
before_render :choose_render
def my_custom_action
...
@records = <something>
.,.
end
...
def choose_render
if @records.first # here is an exception (@records is nil)...
...
end
end
but it is not possible, since @records is not available in the context of the callback function choose_render.