-
Type:
Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
In the docs, there is an example of using lambdas with the store_in macro:
class Band
include Mongoid::Document
store_in database: ->
end
However, it does not work as expected:
Thread.current[:database] = 'first'
Band.database_name #=> :first
Thread.current[:database] = 'second'
Band.database_name #=> :first (when :second is expected)
I believe this is because #database_name memoizes the name when it is called for the first time.
Same thing happens for #collection_name as well.