Method: SimonSays::Authorizer::ClassMethods#find_and_authorize

Defined in:
lib/simon_says/authorizer.rb

#find_and_authorize(resource, *roles) ⇒ Object

Find and authorize a resource.



48
49
50
51
52
53
54
55
56
# File 'lib/simon_says/authorizer.rb', line 48

def find_and_authorize(resource, *roles)
  opts = roles.extract_options!

  before_action(action_options(opts)) do
    find_resource resource, opts

    authorize roles, opts unless roles.empty?
  end
end