I'd like to set "respond_to" part of action outside of action.
This is an example of how it should work:
def index
...
end
def show
...
end
response_for :index, :show do
format.html do
if empty_records?
redirect_to root_path
end
end
format.json do
...
end
end
Earlier I used response_for gem for this but it isn't supported anymore. What solutions can you advice? I use Rails 4.2.