Changed find_first_model to cope with Mongoid 3.0.0 #41

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants

Klass.first(conditions) no longer works in Mongoid 3 (it breaks with an ArgumentError).

Updated the method to stop it raising errors. (It should still work in previous versions too).

Owner

ianwhite commented Jul 6, 2012

Many thanks!

@bbenezech bbenezech added a commit to bbenezech/pickle that referenced this pull request Oct 15, 2012

@bbenezech bbenezech Merge pull request #41 from julescopeland/master
Changed find_first_model to cope with Mongoid 3.0.0
c60ea88
Contributor

jondkinney commented Nov 17, 2014

Looks to be a duplicate of #47 (I know, this one was created first :) However, I recommend closing this and merging #47 as it has some additional code.

Collaborator

chewi commented Nov 18, 2014

Agreed.

chewi closed this Nov 18, 2014

Collaborator

chewi commented Nov 21, 2014

Strike that, reverse it. #47 was for ActiveRecord, this is for Mongoid.

chewi reopened this Nov 21, 2014

Contributor

jondkinney commented Nov 21, 2014

Aaaah! Sorry. The code is the exact same, but it's in different files. I didn't notice that!

Do we need to update https://github.com/julescopeland/pickle/blob/master/lib/pickle/adapters/mongoid.rb#L35 too? Seems like it could be:

klass.all(conditions)
Collaborator

chewi commented Nov 21, 2014

Already on it. Fixed in a backwards-compatible way.

chewi closed this Nov 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment