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! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-22 23:43 UTC
Re: validates_numericality_of accepts true, is this right?
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 <abhikp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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! > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
apramanik
2008-Jan-23 00:34 UTC
Re: validates_numericality_of accepts true, is this right?
It''s a decimal field. On Jan 22, 3:43 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 <abh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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! > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-23 00:42 UTC
Re: validates_numericality_of accepts true, is this right?
It will do the same thing then. On Jan 23, 2008 11:04 AM, apramanik <abhikp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > It''s a decimal field. > > On Jan 22, 3:43pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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 <abh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > 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! > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email. > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---