We have two columns which require to be declared as t.integer size(1) and size(2).
i.e. a max size of 1 (i.e upto 9) and max size of 2 (i.e upto 99). How should I declare this in my migration script.
Do you mean that the value in that column should be restricted to the range 1-99?
Having created an integer column you could add ActiveRecord validation to the model:
validates_numericality_of :field_name, :in => 1..99
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With