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

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.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-11-21 07: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?
csn
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-11-21 20: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
vote_average:

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

Anybody know what the problem is?

thanks
csn
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-11-21 23:55
(Received via mailing list)
This appears to be a problem with the latest ruby-postgres snapshot.
I've filed a ticket.

csn
This topic is locked and can not be replied to.