method

after_action

after_action
public

Append a callback after actions. See _insert_callbacks for parameter details. Aliased as after_filter.

1Note

Params of conditions

edivandecastro ยท Feb 3, 2016

You can pass an proc for o callback with the conditions

after_action :initial_value, only: [:index, :show], unless: -> { @foo.nil? }

after_action :initial_value, only: [:index, :show], if: -> { @foo }