Module: Capable::ActsAsCapabilityRenewer::InstanceMethods

Defined in:
lib/acts_as_capability_renewer.rb

Instance Method Summary collapse

Instance Method Details

#create_capabilities(capable, abilities, active, expires_at) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/acts_as_capability_renewer.rb', line 21

def create_capabilities(capable, abilities, active, expires_at)
  if capable.present? and abilities.present? and self.capabilities.count == 0
    abilities.each do |ability|
      Capability.create_capability(capable, ability, active, expires_at, self)
    end
  end
end

#renew_capabilities(expires_at) ⇒ Object



29
30
31
32
33
# File 'lib/acts_as_capability_renewer.rb', line 29

def renew_capabilities(expires_at)
  self.capabilities.each do |capability|
    capability.renew(expires_at)
  end
end