Module: Vigilante::ControllerExtension::ClassMethods

Defined in:
lib/vigilante/controller_extension.rb

Instance Method Summary collapse

Instance Method Details

#protected_by_vigilanteObject

this method should be called inside the ApplicationController, and will add all standard Vigilante behaviour

Raises:

  • (VigilanteException)


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vigilante/controller_extension.rb', line 17

def protected_by_vigilante
  # make sure this can only be called from ApplicationController!!
  #logger.debug "called from #{self.to_s}"

  raise VigilanteException.new("protected_by_vigilante must be called from the ApplicationController!") unless self.to_s.split("::").last == "ApplicationController"

  # add ApplicationController - code
  module_eval do
    include Vigilante::Authorization
  end
end