b47cdc7ad7
#327 #327 #327 #327 Merge remote-tracking branch 'origin/main' into feature/327 #327 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #342
11 lines
318 B
Ruby
11 lines
318 B
Ruby
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
|