lib/generators/cancannible/templates/permission.rb in cancannible-1.0.0 vs lib/generators/cancannible/templates/permission.rb in cancannible-1.0.1
- old
+ new
@@ -1,8 +1,13 @@
# The Permission class stores permissions managed by CanCan and Cancannible
class Permission < ActiveRecord::Base
belongs_to :permissible, polymorphic: true
belongs_to :resource, polymorphic: true
+ # 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
+
validates_uniqueness_of :ability, scope: [:resource_id, :resource_type, :permissible_id, :permissible_type]
end
\ No newline at end of file