|
- class IpAddress < ApplicationRecord
- validates :ip_address, presence: true, length: { maximum: 16 }
-
- has_many :user_ips, dependent: :destroy
- has_many :users, through: :user_ips
-
- def banned? = banned_at.present?
- def ban! = banned? || update!(banned_at: Time.current)
- def unban! = update!(banned_at: nil)
- end
|