lib/mongo_mapper/plugins/accessible.rb in mongo_mapper-0.10.0 vs lib/mongo_mapper/plugins/accessible.rb in mongo_mapper-0.10.1
- old
+ new
@@ -13,11 +13,11 @@
self.accessible_attributes = Set.new(attrs) + (accessible_attributes || [])
end
end
module InstanceMethods
- def assign(attrs={})
+ def attributes=(attrs={})
super(filter_inaccessible_attrs(attrs))
end
def update_attributes(attrs={})
super(filter_inaccessible_attrs(attrs))
@@ -27,10 +27,10 @@
super(filter_inaccessible_attrs(attrs))
end
protected
def filter_inaccessible_attrs(attrs)
- return attrs if accessible_attributes.blank? || attrs.blank?
+ return attrs if !accessible_attributes? || attrs.blank?
attrs.dup.delete_if { |key, val| !accessible_attributes.include?(key.to_sym) }
end
end
end
end
\ No newline at end of file