deciml

Hi
   In my table I have
t.decimal :rent, :precision => 12, :scale => 2

    But when ever I enter a large value like
1234567890333.465

    To the table it is stored as 9999999999.99

         I would like to know how active record validation can be
applied here?

Thanks
Tom

Have a look at the rails guide on validations at
http://guides.rubyonrails.org. Particularly validates_numericality_of
which allows a range of values to be specified.

Colin

Hi,
     When you set field to decimal than default it accept 10 digits. so
when you add the value over the limit it set to maximum decimal value.

     Add two validation in this case:

     a. validates_length_of - for length of decimal
     b. validates_numericality_of - for digits only

Hi,
When you set field to decimal than default it accept 10 digits. so
when you add the value over the limit it set to maximum decimal value.

Add two validation in this case:

a\. validates\_length\_of \- for length of decimal
b\. validates\_numericality\_of \- for digits only

If validates_numericality_of is used with :less_than (and probably
:more_than) then I think the length_of test is not necessary.

Colin

Hi
    Thanks for all your reply

Tom