Skip to content

Commit

Permalink
Mongo Context: Fixed a bug where context.fetch(nil) returned the firs…
Browse files Browse the repository at this point in the history
…t record found instead of nil. It got this silly idea from the Mongo find_one method.
  • Loading branch information
paploo committed Apr 15, 2011
1 parent 130d2fe commit bd70a82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.rdoc
Expand Up @@ -160,6 +160,10 @@ mailto:jeff@paploo.net

= Version History

[0.1.8 - 2011-Apr-15] Bug Fixes.
* MongoContext: context.fetch(nil) returns nil. Turns out
Mongo's coll.find_one(nil) returned first record, and so
that is what we were doing but didn't actually want to do.
[0.1.7 - 2011-Apr-06] Bug Fixes.
* MongoContext: Fixed it to send :after_fetch events after a find.
* MongoContext: Dereferencing a DBRef.
Expand Down
1 change: 1 addition & 0 deletions lib/poro/contexts/mongo_context.rb
Expand Up @@ -89,6 +89,7 @@ def data_store=(collection)
attr_writer :attempt_id_conversion

def fetch(id)
return nil if id.nil? #find_one(nil) returns the first object! We don't want this.
data = data_store.find_one( clean_id(id) )
obj = convert_to_plain_object(data)
callback_event(:after_fetch, obj)
Expand Down
2 changes: 1 addition & 1 deletion lib/poro/version.rb
Expand Up @@ -3,5 +3,5 @@
# existing plain ol' ruby objects as little as possible. For more information
# see README.rdoc.
module Poro
VERSION = '0.1.7'
VERSION = '0.1.8'
end

0 comments on commit bd70a82

Please sign in to comment.