I have text field with name print run which has to be validated in the format of
Valid values for the print run field, are positive integers, 'Unlimited', and 'Silent'.
I have added validation like this
VALID_NAMES = %w(Unlimited silent #k)
validates_inclusion_of :print_run, :in => VALID_NAMES
how to proceed for validation to accept positive integers also...
validates_numericality_of :print_run, :only_integer => true, :message => "can only be whole number."
the above validation accept only numeric
Integer(attributes_before_type_cast["print_run"])
errors.add_to_base( "print_run must be a number")
the above statement accepts only the number but no validation for positive integers
how to proceed with this..