ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

11 lines
318 B

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