Storing BigDecimal in the db


#1

I need to do some precise math, going to 12-14 decimal places, so I’m
using BigDecimal. How can I store this in a db? I’m using postgresql
8.1.0, if that matters at all. I found a plugin [1] but it gives me
the error “You have a nil object when you didn’t expect it! The error
occurred while evaluating nil.each_pair,” with no line number. The
plugin itself never calls #each_pair, so it has to be somewhere inside
Rails or the postgres adapter. I’m using Rails 1.1.2 and the postgres
0.7.1 adapter.

Pat


#2

On 5/24/06, Pat M. removed_email_address@domain.invalid wrote:

I found a plugin [1]

Hrm, referenced a link and forgot to include it.

[1] http://lists.rubyonrails.org/pipermail/rails/2006-April/033425.html


#3

On Thursday 25 May 2006 04:16, Pat M. wrote:

I need to do some precise math, going to 12-14 decimal places, so I’m
using BigDecimal. How can I store this in a db? I’m using postgresql
8.1.0, if that matters at all. I found a plugin [1] but it gives me
the error “You have a nil object when you didn’t expect it! The error
occurred while evaluating nil.each_pair,” with no line number. The
plugin itself never calls #each_pair, so it has to be somewhere inside
Rails or the postgres adapter. I’m using Rails 1.1.2 and the postgres
0.7.1 adapter.

Hi Pat

I wrote that :slight_smile:

Can you be more specific about what you are trying to do? Maybe I can
help
track down the issue.

Ashley


#4

On 5/25/06, Ashley M. removed_email_address@domain.invalid wrote:

Hi Pat

  • Gregory Chudnovsky

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Hey Ashley,

I’m using Duane J.'s column_comments plugin [1], and that’s where
the error popped up. I’m not entirely sure why the error occurs, as I
just wrapped the problem code in an “unless cols.nil?..end” block.
Anyway it’s nothing wrong with your plugin. Now schema dumps actually
work :slight_smile: Thanks for doing this, and I’ll look into the column_comments
plugin and get a solution for Duane.

Pat

[1] http://blog.inquirylabs.com/2006/04/27/columncomments-rails-plugin/