Forum: Ruby on Rails Storing BigDecimal in the db

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-05-25 05:19
(Received via mailing list)
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
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-05-25 06:58
(Received via mailing list)
On 5/24/06, Pat Maddox <pergesu@gmail.com> wrote:
>  I found a plugin [1]

Hrm, referenced a link and forgot to include it.

[1] http://lists.rubyonrails.org/pipermail/rails/2006-...
A90204c955db033cd975f7bb0ec9600b?d=identicon&s=25 Ashley Moran (Guest)
on 2006-05-25 15:04
(Received via mailing list)
On Thursday 25 May 2006 04:16, Pat Maddox 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 :)

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

Ashley
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-05-25 16:29
(Received via mailing list)
On 5/25/06, Ashley Moran <work@ashleymoran.me.uk> wrote:
> Hi Pat
>   - Gregory Chudnovsky
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

Hey Ashley,

I'm using Duane Johnson'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 :)  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/columncomme...
This topic is locked and can not be replied to.