module Restrict::Rails::Controller::ClassMethods
Public Instance Methods
install_gatekeeper()
click to toggle source
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.
# 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)
click to toggle source
# File lib/restrict/rails/controller.rb, line 15 def restrict(*args) install_gatekeeper restrict_restrictions << Restrict::Restriction.new(*args) end
Private Instance Methods
restrict_restrictions()
click to toggle source
Access the class instance variable. Do not mistake this method with the instance method `#restrictions` which is actually used to determine access and that respects inherited restrictions. Hence the `__` name.
# File lib/restrict/rails/controller.rb, line 24 def restrict_restrictions @restrictions ||= [] end