This validation restricts the insertion of only numeric values.

class Player < ApplicationRecord
  validates :points, numericality: true
  validates :games_played, numericality: { only_integer: true }
end

Besides :only_integer, this helper also accepts the following options to add constraints to acceptable values:

By default, numericality doesn’t allow nil values. You can use allow_nil: true option to permit it.