Module: Padrino::CanCan::Helpers

Defined in:
lib/padrino-cancan/helpers.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

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 authorize! *args
  current_ability.authorize! *args
end

#can?(*args) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/padrino-cancan/helpers.rb', line 8

def can? *args
  current_ability.can? *args
end

#cannot?(*args) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/padrino-cancan/helpers.rb', line 12

def cannot? *args
  current_ability.cannot? *args
end

#current_abilityObject



4
5
6
# File 'lib/padrino-cancan/helpers.rb', line 4

def current_ability
  @ability ||= Ability.new(, registered_abilities)
end

#registered_abilitiesObject



20
21
22
# File 'lib/padrino-cancan/helpers.rb', line 20

def registered_abilities
  self.class.registered_abilities
end