Skip to content

Commit

Permalink
Fixed from mongo receiving Money objects for reasons I do not know so…
Browse files Browse the repository at this point in the history
… could not write a spec.
  • Loading branch information
tjtuom committed Jul 12, 2010
1 parent c0198c0 commit 8156d63
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/mm-money.rb
Expand Up @@ -14,10 +14,12 @@ def self.to_mongo(value)
end

def self.from_mongo(value)
if value.nil?
nil
else
if value.kind_of?(Money)
value
elsif value.kind_of?(Array)
Money.new(value.first, value.second)
else
nil
end
end
end

0 comments on commit 8156d63

Please sign in to comment.