in previous released of Mongoid (2.0.beta.20), I could pass a class type as the
2nd parameter of the .find_or_create_by block on embedded document collections.
this doesn’t appear to be the case any more, with v2.0.1, yet I still
need to do polymorphic find_or_create_by. any suggestions / pointers
on how to do this?
I used to do this:
SomeClass.childclass.find_or_create_by({:key => "value"},
InheritingChildClass)
now I get an exception saying too many arguments (2 for 1)
on .find_or_create_by.
how can I tell the collection to create an object of the correct type, when using find_or_create_by? Or, how can i create my own method that will be functionaly equivalent to what I want, and be re-usable across my embedded document collections?
any help is appreciated.
thanks.
I ended up rolling my own solution for this