validateの整数制限・Fakerの整数生成

validateの整数制限

# app/models/user.rb
class User < ApplicationRecord
  validates :age, presence: true, numericality: { only_integer: true }
end

Fakerの整数値生成

price { Faker::Number.between(from: 300, to: 9999999)  }