Forum: Ruby on Rails Postgres real being treated as boolean?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
cool_screen_name90001 (Guest)
on 2005-11-21 08:35
(Received via mailing list)
I have a real number column ("real") in Postgres and I think it might be
being treated as a
boolean. In my template I have:

<%= number_with_precision(item.vote_average, 2) %>

and it's outputting 1.00 for everything (they're not all 1's in the
database). Actually, I have to
enclose that code in begin...rescue otherwise I get an "undefined method
'to_f'" if
item.vote_average is 0 in the database.

what's happening?
cool_screen_name90001 (Guest)
on 2005-11-21 21:58
(Received via mailing list)
Something wacky is going on. When I do 'debug(item)' I get values like:

vote_average: 1
vote_average: true

While in the database, vote_average's (type "real") values are like
3.5423, 4, 2.451, etc.

Anybody know what the problem is?

cool_screen_name90001 (Guest)
on 2005-11-22 00:55
(Received via mailing list)
This appears to be a problem with the latest ruby-postgres snapshot.
I've filed a ticket.

This topic is locked and can not be replied to.