Skip to content
Browse files

only backport the to_d method if it does not exist

  • Loading branch information...
1 parent 95d35fc commit 23c5403b42696d6f6dcb424c5a534681441a64bd @tenderlove tenderlove committed Aug 24, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
View
7 activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
@@ -29,8 +29,11 @@ def encode_with(coder)
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
end
- def to_d
- self
+ # Backport this method if it doesn't exist
+ unless method_defined?(:to_d)
+ def to_d
+ self
+ end
end
DEFAULT_STRING_FORMAT = 'F'

0 comments on commit 23c5403

Please sign in to comment.
Something went wrong with that request. Please try again.