Sha256: f44d1c3bf64c0812d7a92069ef2e869394d8e5ccc8e04e50a1bc7e66d2a534f0

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# These model definitions are just used for the test scenarios

# The Permission class stores permissions maanged by CanCan and Cancannible
class Permission < ActiveRecord::Base
  belongs_to :permissible, polymorphic: true
  belongs_to :resource, polymorphic: true

  validates_uniqueness_of :ability,
    :scope => [:resource_id, :resource_type,
      :permissible_id, :permissible_type]
end

class Member < ActiveRecord::Base
  include Cancannible
end

class User < ActiveRecord::Base
  has_many :roles_users, class_name: 'RolesUsers'
  has_many :roles, :through => :roles_users
  belongs_to :group

  include Cancannible
  inherit_permissions_from :roles, :group
end

class RolesUsers < ActiveRecord::Base
  belongs_to :role
  belongs_to :user
end

class Role < ActiveRecord::Base
  has_many :roles_users, :class_name => 'RolesUsers'
  has_many :users, :through => :roles_users

  include Cancannible
end

class Group < ActiveRecord::Base
  has_many :users

  include Cancannible
end

class Widget < ActiveRecord::Base
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cancannible-0.0.1 spec/support/models.rb