Module: AccessGranted::ControllerMethods
- Defined in:
- lib/access-granted/controller_methods.rb
Class Method Summary collapse
Instance Method Summary collapse
- #authorize!(*args) ⇒ Object
- #can?(*args) ⇒ Boolean
- #cannot?(*args) ⇒ Boolean
- #current_policy ⇒ Object
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/access-granted/controller_methods.rb', line 7 def self.included(base) base.helper_method :can?, :cannot?, :current_ability end |
Instance Method Details
#authorize!(*args) ⇒ Object
19 20 21 |
# File 'lib/access-granted/controller_methods.rb', line 19 def (*args) current_policy.(*args) end |
#can?(*args) ⇒ Boolean
11 12 13 |
# File 'lib/access-granted/controller_methods.rb', line 11 def can?(*args) current_policy.can?(*args) end |
#cannot?(*args) ⇒ Boolean
15 16 17 |
# File 'lib/access-granted/controller_methods.rb', line 15 def cannot?(*args) current_policy.cannot?(*args) end |
#current_policy ⇒ Object
3 4 5 |
# File 'lib/access-granted/controller_methods.rb', line 3 def current_policy @current_policy ||= ::Policy.new(current_user) end |