lib/mongo_mapper/plugins/accessible.rb in mongo_mapper-0.13.1 vs lib/mongo_mapper/plugins/accessible.rb in mongo_mapper-0.14.0.rc1

- old
+ new

@@ -40,22 +40,23 @@ def accessible_attributes? self.class.accessible_attributes? end - protected - def filter_inaccessible_attrs(attrs) - return attrs if !accessible_attributes? || attrs.blank? - attrs.dup.delete_if { |key, val| attribute_inaccessible?(key.to_sym) } - end + protected - 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) + def filter_inaccessible_attrs(attrs) + return attrs if !accessible_attributes? || attrs.blank? + attrs.dup.delete_if { |key, val| attribute_inaccessible?(key.to_sym) } + end - return true - 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