Module: Padrino::CanCan::Helpers
- Defined in:
- lib/padrino-cancan/helpers.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #authorize!(*args) ⇒ Object
- #can?(*args) ⇒ Boolean
- #cannot?(*args) ⇒ Boolean
- #current_ability ⇒ Object
- #registered_abilities ⇒ Object
Class Method Details
.included(base) ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/padrino-cancan/helpers.rb', line 44 def self.included(base) #:nodoc: base.extend(ClassMethods) end |
Instance Method Details
#authorize!(*args) ⇒ Object
16 17 18 |
# File 'lib/padrino-cancan/helpers.rb', line 16 def *args current_ability. *args end |
#can?(*args) ⇒ Boolean
8 9 10 |
# File 'lib/padrino-cancan/helpers.rb', line 8 def can? *args current_ability.can? *args end |
#cannot?(*args) ⇒ Boolean
12 13 14 |
# File 'lib/padrino-cancan/helpers.rb', line 12 def cannot? *args current_ability.cannot? *args end |
#current_ability ⇒ Object
4 5 6 |
# File 'lib/padrino-cancan/helpers.rb', line 4 def current_ability @ability ||= Ability.new(current_account, registered_abilities) end |
#registered_abilities ⇒ Object
20 21 22 |
# File 'lib/padrino-cancan/helpers.rb', line 20 def registered_abilities self.class.registered_abilities end |