Method: AbstractController::Callbacks::ClassMethods#callback
- Defined in:
- lib/abstract_controller/callbacks.rb
#callback ⇒ Object
:method: append_around_action
:call-seq: append_around_action(names, block)
Append a callback around actions. See _insert_callbacks for parameter details. set up before_action, prepend_before_action, skip_before_action, etc. for each of before, after, and around.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/abstract_controller/callbacks.rb', line 232 [:before, :after, :around].each do |callback| define_method "#{callback}_action" do |*names, &blk| _insert_callbacks(names, blk) do |name, | set_callback(:process_action, callback, name, ) end end define_method "prepend_#{callback}_action" do |*names, &blk| _insert_callbacks(names, blk) do |name, | set_callback(:process_action, callback, name, .merge(prepend: true)) end end # Skip a before, after or around callback. See _insert_callbacks for details on # the allowed parameters. define_method "skip_#{callback}_action" do |*names| _insert_callbacks(names) do |name, | skip_callback(:process_action, callback, name, ) end end # *_action is the same as append_*_action alias_method :"append_#{callback}_action", :"#{callback}_action" end |