Sha256: 6f392386b79a16c597c74417c8281223e364c6c1c8787e5c6470c43a4b5f19de

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

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

  validates :ability, uniqueness: { scope: [:resource_id, :resource_type, :permissible_id, :permissible_type] }

  # Note: for Rails 3 you may need to declare attr_accessible as follows, depending on your whitelist_attributes setting.
  # A future version of cancannible should make this unnecessary.
  #
  # attr_accessible :asserted, :ability, :resource_id, :resource_type
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cancannible-2.1.0 lib/generators/cancannible/templates/permission.rb
cancannible-2.0.0 lib/generators/cancannible/templates/permission.rb