kimda
(kimda)
1
Hi,
When column's data type is NUMBER (oracle) validates_length_of doesn't
seem to work.
validates_length_of :bsa, :maximum=>3
I get error message even though I didn't put anything and if I enter
something, I get 'size' is undefined error.
If I do that:
validates_length_of :bsa, :within => 1..999 , :allow_nil => true
I get wrong number of arguments (1 for 0) error.
I also googled, but could find specific way of validates length of
number data type.
thanks in advance,
When column's data type is NUMBER (oracle) validates_length_of doesn't
seem to work.
validates_length_of :bsa, :maximum=>3
validates_length_of is for validating string lengths.
I also googled, but could find specific way of validates length of
number data type.
Override the validate method in the model.
def validate
if bsa > 999 errors.add( :bsa, 'too big' )
if bsa < 1 errors.add( :bsa, 'too small' )
end
kimda
(kimda)
3
Great! It works. Thank you so much!