Not really. validates_numericality_of is a class method that defines
an appropriate validation on a class. You may find the :allow_nil
and :if or :unless options useful
Well, if the column will hold numbers sure there is an advantage. You
can perform arithmetic and numeric comparisons. You can sort based on
the natural order of numbers, not based on lexicographical order.
Yeah, that’s true enough.
I’ll get it changed as I want to do everything properly.
Thanks for your help.
I created the field ‘children’ as a string (can’t remember why, perhaps
because someone might enter ‘none’??), so that doesn’t work.
Is there any big advantage to changing the field ‘children’ into an
interger?
Well, if the column will hold numbers sure there is an advantage. You
can perform arithmetic and numeric comparisons. You can sort based on
the natural order of numbers, not based on lexicographical order.
Stephan
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.