user_ip.rb 360 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: user_ips
  5. #
  6. # user_id :bigint(8) primary key
  7. # ip :inet
  8. # used_at :datetime
  9. #
  10. class UserIp < ApplicationRecord
  11. include DatabaseViewRecord
  12. include InetContainer
  13. self.primary_key = :user_id
  14. belongs_to :user
  15. scope :by_latest_used, -> { order(used_at: :desc) }
  16. end