-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
All,
At present, I believe having a default_scope on a model will interfere with the uniqueness validation. If you add a default scope to the spec model located at spec/app/models/dictionary.rb such that it becomes:
class Dictionary include Mongoid::Document field :name, type: String field :publisher, type: String field :year, type: Integer field :published, type: Time has_many :words, validate: false default_scope where(published: 1999) end
... then a large chunk of tests will fail. A further example is explained in this gist.
I do not have time at the moment to implement a patch, but will try to do so if someone else doesn't beat me to it. I bet it's a matter of making sure unscoped is used during the validation.
Thanks!