-
Type:
Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Currently we have first_or_create and first_or_initialize. Both of these methods pick apart the query criteria and attempt to mass-assign attributes.
Often my query contains non-mass-assignable attributes, which gives warnings. I'd prefer to have a much simpler method first_or_new like so:
module Mongoid module Document module ClassMethods def first_or_new(attrs = {}) first || self.new(attrs) end end end end