Created
March 25, 2011 15:37
-
-
Save emachnic/887045 to your computer and use it in GitHub Desktop.
Trying to create a Mongoid document from params received through ActiveMerchant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Donation | |
include Mongoid::Document | |
field :success, :type => String | |
field :authorization, :type => String | |
field :message, :type => String | |
field :params, :type => Hash, :default => {} | |
def response=(response) | |
self.success = response.success? | |
self.authorization = response.authorization | |
self.message = response.message | |
self.params = response.params | |
rescue ActiveMerchant::ActiveMerchantError => e | |
self.success = false | |
self.authorization = nil | |
self.message = e.message | |
self.params = {} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried it out locally and am seeing the same behavior you are. It looks like it might be a bug in Mongoid.