Skip to content
Browse files

Don't audit MongoMapper's "_id" attribute

  • Loading branch information...
1 parent af6ed6a commit 057e8fa1f101eb5a8b8aa31f386118e0aae34b09 @laserlemon laserlemon committed Apr 24, 2012
View
2 lib/audited/adapters/mongo_mapper.rb
@@ -4,7 +4,7 @@
module Audited::Auditor::ClassMethods
def default_ignored_attributes
- ['id']
+ ['id', '_id']
end
end
View
1 lib/audited/auditor.rb
@@ -151,6 +151,7 @@ def audited_attributes
def revision_with(attributes)
self.dup.tap do |revision|
+ revision.id = id
revision.send :instance_variable_set, '@attributes', self.attributes
revision.send :instance_variable_set, '@new_record', self.destroyed?
revision.send :instance_variable_set, '@persisted', !self.destroyed?
View
2 spec/audited/adapters/mongo_mapper/auditor_spec.rb
@@ -11,7 +11,7 @@
Models::MongoMapper::User.should be_a_kind_of( Audited::Auditor::AuditedClassMethods )
end
- ['created_at', 'updated_at', 'created_on', 'updated_on', 'lock_version', 'id', 'password'].each do |column|
+ ['created_at', 'updated_at', 'created_on', 'updated_on', 'lock_version', 'id', '_id', 'password'].each do |column|
it "should not audit #{column}" do
Models::MongoMapper::User.non_audited_columns.should include(column)
end

0 comments on commit 057e8fa

Please sign in to comment.
Something went wrong with that request. Please try again.