Module: ActionControllerExtensions

Defined in:
lib/before_or_404/action_controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#before_or_404(*names, &blk) ⇒ Object



2
3
4
5
6
# File 'lib/before_or_404/action_controller_extensions.rb', line 2

def before_or_404(*names, &blk)
  _insert_callbacks(names, blk) do |name, options|
    set_callback :process_action, :before, wrapper_for(name).method, options
  end
end

#prepend_before_or_404(*names, &blk) ⇒ Object



8
9
10
11
12
# File 'lib/before_or_404/action_controller_extensions.rb', line 8

def prepend_before_or_404(*names, &blk)
  _insert_callbacks(names, blk) do |name, options|
    set_callback(:process_action, :before, wrapper_for(name).method, options.merge(:prepend => true))
  end
end

#skip_before_or_404(*names, &blk) ⇒ Object



14
15
16
17
18
# File 'lib/before_or_404/action_controller_extensions.rb', line 14

def skip_before_or_404(*names, &blk)
  _insert_callbacks(names, blk) do |name, options|
    skip_callback(:process_action, :before, wrapper_for(name).method, options)
  end
end