Skip to content

Commit

Permalink
Merge pull request #122 from mcolyer/fix-psych-deserialization
Browse files Browse the repository at this point in the history
Check for `@values` in StripeObject#method_not_found.

This is necessary because we check for `@values` in `respond_to_missing?` now, but this isn't necessarily always set. For example, in deserializing from YAML, Psych creates the object using `allocate` and not `new`, which ends up skipping any initializing of instance variables. See #122 for more details.
  • Loading branch information
amfeng committed Jul 9, 2014
2 parents 5279226 + 974f5ce commit 8bb6acf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stripe/stripe_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def method_missing(name, *args)
end

def respond_to_missing?(symbol, include_private = false)
@values.has_key?(symbol) || super
@values && @values.has_key?(symbol) || super
end
end
end

0 comments on commit 8bb6acf

Please sign in to comment.