mongoid/mongoid — Issue #1810: Document is marked as changed when a hash-attribute is read
Author: semaperepelitsa
Created: 2012-03-10 01:43:08+00:00
State: open

I have an issue similar to #1199. When I read a hash-attribute the document is marked as changed but it is not.

```ruby
gem "mongoid", "2.4.6"
require "mongoid"

Mongoid.configure do |config|
config.master = Mongo::Connection.new.db("mongoid_bugs")
end

class User
include Mongoid::Document
field :preferences
end

user = User.create! preferences: { :foo => :bar }

p user.changed?, user.preferences_changed?, user.changes #=> false, false, {}
puts

user.preferences
p user.changed?, user.preferences_changed?, user.changes #=> true, false, {"preferences"=>nil}
```