Sha256: f6778b9567a28ff16c9a270aed5f9e9180f3ef1e291c2327d11c7251dd3009de

Contents?: true

Size: 342 Bytes

Versions: 5

Compression:

Stored size: 342 Bytes

Contents

class Ability
  include ::CanCan::Ability
  
  def initialize(user)
    user.role.permissions.each do |permission|
      if permission.subject_class == "all"
        can permission.action.to_sym, permission.subject_class.to_sym
      else
        can permission.action.to_sym, permission.subject_class.constantize
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pbw-0.0.6 app/models/pbw/ability.rb
pbw-0.0.5 app/models/pbw/ability.rb
pbw-0.0.4 app/models/pbw/ability.rb
pbw-0.0.3 app/models/pbw/ability.rb
pbw-0.0.2 app/models/pbw/ability.rb