spec/support/models.rb in cancannible-1.0.1 vs spec/support/models.rb in cancannible-2.0.0
- old
+ new
@@ -1,14 +1,11 @@
# 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
+ belongs_to :resource, polymorphic: true, optional: true
- validates_uniqueness_of :ability,
- :scope => [:resource_id, :resource_type,
- :permissible_id, :permissible_type]
+ validates :ability, uniqueness: { scope: [:resource_id, :resource_type, :permissible_id, :permissible_type] }
end
class Member < ActiveRecord::Base
include Cancannible::Grantee
end