-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
class SomeModel include Mongoid::Document field :somefield validates_uniqueness_of :somefield end SomeModel.with(collection: 'new_name').create({ 'key' => 'val' })
When dynamically setting the collection name using with if theres a call to validates_uniqueness_of the record will automatically be written to the "some_model" collection instead of the "new_name" collection. No error or warning is thrown. This does not seem like the desired behavior. Is there another way to handle uniqueness of fields in dynamic collection names?