On 5/13/2011 8:14 AM, byrnejb wrote:
On Mar 30, 5:23 pm, Michael Koziarski<[email protected]> wrote:
As Fred mentions later in the thread your issue here is twofold. One
is that Rails isn't correctly understanding 'infinity', that's
obviously postgresql specific and has no parallel in ruby itself (as
you said). That'll never be fixed.
Actually, it turn out that 'infinity' is supported in Ruby.
Apparently infinity can be represented by assigning the value obtained
by dividing a float by zero.
$ irb
ruby-1.8.7-p334 :001> infinity = 1.0/0
=> Infinity
ruby-1.8.7-p334 :002> ninfinity = -1.0/0
=> -Infinity
ruby-1.8.7-p334 :003>
So, I guess this now qualifies as a bug in the Ruby pg adapter gem.
FWIW - you don't have to divide by zero to get infinity. You can use
Float::INFINITY.
jack@shepherd:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
jack@shepherd:~$ irb
irb(main):001:0> Float::INFINITY == (1.0/0)
=> true
Jack
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.