ぼざクリタグ広場 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.
 
 
 
 
 

15 lines
378 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?
  6. def banned = banned?
  7. def banned= value
  8. bool = ActiveModel::Type::Boolean.new.cast(value)
  9. self.banned_at = bool ? banned_at || Time.current : nil
  10. end
  11. end