Skip to content

Commit

Permalink
Fix for Mongoid 2.1 ActiveModel dirty tracking
Browse files Browse the repository at this point in the history
As of mongoid/mongoid@30615c6, uses
ActiveModel dirty tracking. `previous_changes` now returns nil instead
of an empty hash, etc.

Dirty attributes are now cleared after all persistence callbacks have
fired, so previous after-save `previous_changes` now becomes simply
`changes`. This is consistent with ActiveRecord.
mongoid/mongoid@08cf1ba
  • Loading branch information
ches committed Aug 3, 2011
1 parent 9cd184f commit 802cbb9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mongoid/taggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Mongoid::Taggable
set_callback :create, :after, :aggregate_tags!
set_callback :destroy, :after, :aggregate_tags!
set_callback :save, :before, :dedup_tags!, :if => proc { changes.include?(tags_field.to_s) }
set_callback :save, :after, :aggregate_tags!, :if => proc { previous_changes.include?(tags_field.to_s) }
set_callback :save, :after, :aggregate_tags!, :if => proc { changes.include?(tags_field.to_s) }
end

module ClassMethods
Expand Down
2 changes: 1 addition & 1 deletion mongoid_taggable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = '>= 1.3.6'

s.add_runtime_dependency('mongoid', ['~> 2.0.0.beta.20'])
s.add_runtime_dependency('mongoid', ['~> 2.1'])
s.add_development_dependency("bson_ext", ["~> 1.3"])
s.add_development_dependency('database_cleaner', ['~> 0.6.0'])
s.add_development_dependency("rdoc", ["~> 3.5.0"])
Expand Down

0 comments on commit 802cbb9

Please sign in to comment.