aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-07-13 03:23:39 +0000
committerMarcel Molina <marcel@vernix.org>2006-07-13 03:23:39 +0000
commitd68fd78bad38dbafe35534f7218c705fa65c2dd1 (patch)
treeee0bdfe6ad47c6a96b020bc718599c1bb8c62eec
parent1ec9f8d049eda0c52a3045752ed447f371462676 (diff)
downloadrails-d68fd78bad38dbafe35534f7218c705fa65c2dd1.tar.gz
rails-d68fd78bad38dbafe35534f7218c705fa65c2dd1.tar.bz2
rails-d68fd78bad38dbafe35534f7218c705fa65c2dd1.zip
Customize default BigDecimal formatting. [dave@pragprog.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4608 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/core_ext/bigdecimal.rb3
-rw-r--r--activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb7
3 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 5470555d8e..3d010e7008 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Customize default BigDecimal formatting. References #5672 [dave@pragprog.com]
+
* Correctly convert <foo nil="true"> to nil when using Hash.create_from_xml. [Rick]
* Optional identity for Enumerable#sum defaults to zero. #5657 [gensym@mac.com]
diff --git a/activesupport/lib/active_support/core_ext/bigdecimal.rb b/activesupport/lib/active_support/core_ext/bigdecimal.rb
new file mode 100644
index 0000000000..436b3e000f
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/bigdecimal.rb
@@ -0,0 +1,3 @@
+require 'bigdecimal'
+
+require File.dirname(__FILE__) + '/bigdecimal/formatting.rb'
diff --git a/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb b/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb
new file mode 100644
index 0000000000..d86adbea6c
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb
@@ -0,0 +1,7 @@
+class BigDecimal #:nodoc:
+
+ alias :_original_to_s :to_s
+ def to_s(format="F")
+ _original_to_s(format)
+ end
+end \ No newline at end of file