Module: Restrict::Rails::Controller::ClassMethods

Defined in:
lib/restrict/rails/controller.rb

Instance Method Summary collapse

Instance Method Details

#install_gatekeeperObject

This could happen in included block as well, but often you need other before filters to happen before you actually check the restrictions, so lets set it where it is used in the code as well.



31
32
33
34
35
# File 'lib/restrict/rails/controller.rb', line 31

def install_gatekeeper
  return if @restrict_gatekeeper_installed
  before_action :invoke_gatekeeper
  @restrict_gatekeeper_installed = true
end

#restrict(*args) ⇒ Object



15
16
17
18
# File 'lib/restrict/rails/controller.rb', line 15

def restrict(*args)
  install_gatekeeper
  restrict_restrictions << Restrict::Restriction.new(*args)
end