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) }
# app/models/user.rb
class User < ApplicationRecord
validates :age, presence: true, numericality: { only_integer: true }
end
price { Faker::Number.between(from: 300, to: 9999999) }