Sha256: 5ae55cd955a34c2f8107d76e62f198086b9ea929b16eb544da24999f31d814f8
Contents?: true
Size: 409 Bytes
Versions: 1
Compression:
Stored size: 409 Bytes
Contents
module <%= class_name %> class Ability include CanCan::Ability def initialize(user, company) user ||= User.new # guest user (not logged in) raise CanCan::AccessDenied.new("company is nil") if company.nil? raise CanCan::AccessDenied.new("can't login to company #{company.id}") unless company.id == user.company_id can :login, Company, id: user.company_id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
billet-0.0.1 | lib/generators/billet/namespace/templates/abilities/ability.rb.erb |