From bac5da3ccc43785d83628bc1147b3300f1cb5f95 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 24 Aug 2011 16:33:49 -0700 Subject: [PATCH] only backport the to_d method if it does not exist --- .../lib/active_support/core_ext/big_decimal/conversions.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb index 080604147d064..391bdc925d2ba 100644 --- a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +++ b/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'