It does not appear that the identity_map
setting is getting picked up from the config/mongoid.yml
file.
Here's the file:
development:
sessions:
default:
uri: mongodb://localhost:27017/test_development
options: &defaultopts
op_timeout: 60
allow_dynamic_fields: false
identity_map_enabled: true
preload_models: true
raise_not_found_error: false
When this is run through RAILS_ENV=development rails console
the map is not turned on:
$ RAILS_ENV=development rails c
Loading development environment (Rails 3.2.13)
[1] pry(main)> Mongoid.using_identity_map?
=> false
[2] pry(main)> Mongoid.identity_map_enabled?
=> false
Even an attempt to manually load Mongoid
and the file doesn't change it:
[3] pry(main)> require 'mongoid'
=> false
[4] pry(main)> Mongoid.load!("./config/mongoid.yml")
=> {"sessions"=>
{"default"=>
{"uri"=>"mongodb://localhost:27017/test_development",
"options"=>
{"op_timeout"=>60,
"allow_dynamic_fields"=>false,
"identity_map_enabled"=>true,
"preload_models"=>true,
"raise_not_found_error"=>false}}}}
[5] pry(main)> Mongoid.using_identity_map?
=> false
[6] pry(main)> Mongoid.identity_map_enabled?
=> false
Only if I manually set the value does it take affect:
[8] pry(main)> Mongoid.identity_map_enabled = true
=> true
[9] pry(main)> Mongoid.using_identity_map?
=> true
[10] pry(main)> Mongoid.identity_map_enabled?
=> true
Why is the setting not being loaded correctly?
This issue is happening using Rails 3.2.13 and Mongoid 3.1.2.