Validates_numericality_of accepts true, is this right?

Is validates_numericality_of supposed to accept true as a value for
the following options

class Location < ActiveRecord::Base

validates_numericality_of :longitude, :allow_nil =>
true, :greater_than_or_equal_to = -180, :less_than_or_equal_to = 180

end

place = Location.new()
place.longitude = true
assert place.save <- succeeds!

What type is the longitude field? If it’s a integer field, setting true
on
it will make the value 1 and it will return true when you save it.

On Jan 23, 2008 3:56 AM, apramanik [email protected] wrote:

place = Location.new()
place.longitude = true
assert place.save ← succeeds!


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

It’s a decimal field.

It will do the same thing then.

On Jan 23, 2008 11:04 AM, apramanik [email protected] wrote:


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.