Skip to content

Instantly share code, notes, and snippets.

@andrehjr
Created March 22, 2011 17:35
Show Gist options
  • Save andrehjr/881647 to your computer and use it in GitHub Desktop.
Save andrehjr/881647 to your computer and use it in GitHub Desktop.
BigDecimal#to_yaml fails on rails 3.0.4.
# This is only happening in production
# :/
# Any Ideas how to fix?
Loading production environment (Rails 3.0.4)
ruby-1.9.2-p136 :001 > BigDecimal.new("0.33")
=> #<BigDecimal:73fc940,'0.33E0',9(18)>
ruby-1.9.2-p136 :002 > BigDecimal.new("0.33").to_yaml
TypeError: can't define singleton method "encode_with" for BigDecimal
from /home/hp/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych/deprecated.rb:16:in `singleton_method_added'
from /home/hp/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych/deprecated.rb:16:in `define_method'
from /home/hp/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych/deprecated.rb:16:in `quick_emit'
from /home/hp/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.4/lib/active_support/core_ext/big_decimal/conversions.rb:15:in `to_yaml'
from (irb):2
from /home/hp/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.4/lib/rails/commands/console.rb:44:in `start'
from /home/hp/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.4/lib/rails/commands/console.rb:8:in `start'
from /home/hp/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.4/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ruby-1.9.2-p136 :003 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment