Complete the code to validate that the age attribute is a number.
validates :age, [1]: trueThe numericality validator ensures the attribute is a number.
Complete the code to validate that the price attribute is a number greater than 0.
validates :price, numericality: { [1]: 0 }The option greater_than: 0 ensures the number is more than zero.
Fix the error in the validation to allow only integer values for quantity.
validates :quantity, numericality: { [1]: true }The only_integer: true option restricts the value to integers only.
Fill both blanks to validate that score is an integer between 1 and 10 inclusive.
validates :score, numericality: { only_integer: true, [1]: 1, [2]: 10 }Use greater_than_or_equal_to and less_than_or_equal_to to set inclusive range limits.
Fill all three blanks to validate that discount is a number, greater than or equal to 0, and less than 1.
validates :discount, numericality: { [1]: true, [2]: 0, [3]: 1 }The validation requires only_integer: true to restrict to integers, and range limits with greater_than_or_equal_to: 0 and less_than: 1.