aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-08-24 16:33:49 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-08-24 16:33:49 -0700
commitbac5da3ccc43785d83628bc1147b3300f1cb5f95 (patch)
treecfbb2b3091419709197c8f56c7e9a3dd56d8340b
parent4af431285bfd1d7a1eeebb2d55b3613cc37a7c52 (diff)
downloadrails-bac5da3ccc43785d83628bc1147b3300f1cb5f95.tar.gz
rails-bac5da3ccc43785d83628bc1147b3300f1cb5f95.tar.bz2
rails-bac5da3ccc43785d83628bc1147b3300f1cb5f95.zip
only backport the to_d method if it does not exist
-rw-r--r--activesupport/lib/active_support/core_ext/big_decimal/conversions.rb7
1 files 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 080604147d..391bdc925d 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 @@ class BigDecimal
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'