Sha256: 6761d68ffdbb58b50f784eb355fb75dc41f94e6ca4b7659553b518492271ccac

Contents?: true

Size: 638 Bytes

Versions: 4

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true
module Thredded
  class UserDetail < ActiveRecord::Base
    belongs_to :user, class_name: Thredded.user_class, inverse_of: :thredded_user_detail
    validates :user_id, presence: true

    has_many :topics, class_name: 'Thredded::Topic', foreign_key: :user_id, primary_key: :user_id
    has_many :posts, class_name: 'Thredded::Post', foreign_key: :user_id, primary_key: :user_id
    has_many :private_posts, class_name: 'Thredded::PrivatePost', foreign_key: :user_id, primary_key: :user_id

    scope :recently_active, -> { where(arel_table[:last_seen_at].gt(Thredded.active_user_threshold.ago)) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thredded-0.4.0 app/models/thredded/user_detail.rb
thredded-0.3.2 app/models/thredded/user_detail.rb
thredded-0.3.1 app/models/thredded/user_detail.rb
thredded-0.3.0 app/models/thredded/user_detail.rb