lib/mongo_mapper/plugins/accessible.rb in mongo_mapper-0.13.0 vs lib/mongo_mapper/plugins/accessible.rb in mongo_mapper-0.13.1

- old
+ new

@@ -43,10 +43,19 @@ end protected def filter_inaccessible_attrs(attrs) return attrs if !accessible_attributes? || attrs.blank? - attrs.dup.delete_if { |key, val| !accessible_attributes.include?(key.to_sym) } + attrs.dup.delete_if { |key, val| attribute_inaccessible?(key.to_sym) } + end + + def attribute_inaccessible?(attribute) + unless accessible_attributes.include?(attribute) + message = "Can't mass-assign protected attribute: #{attribute}" + MongoMapper.logger ? MongoMapper.logger.warn(message) : puts(message) + + return true + end end end end end \ No newline at end of file