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.
http://www.frozenplague.net
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.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs