Sha256: f46594a666f71ef4628d7b96037e2ef50f3900502a062a9efd1619d4f6a417c6

Contents?: true

Size: 1.17 KB

Versions: 22

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Thredded
  class UserPreference < ActiveRecord::Base
    belongs_to :user, class_name: Thredded.user_class_name, inverse_of: :thredded_user_preference

    with_options(inverse_of: :user_preference, primary_key: :user_id, foreign_key: :user_id,
                 dependent: :destroy) do |opt|
      opt.has_many :messageboard_preferences,
                   class_name: 'Thredded::UserMessageboardPreference'
      opt.has_many :messageboard_notifications_for_followed_topics,
                   class_name: 'Thredded::MessageboardNotificationsForFollowedTopics'
      opt.has_many :notifications_for_followed_topics,
                   class_name: 'Thredded::NotificationsForFollowedTopics'
      opt.has_many :notifications_for_private_topics,
                   class_name: 'Thredded::NotificationsForPrivateTopics'
    end
    validates :user_id, presence: true

    scope :auto_followers, -> { where(auto_follow_topics: true) }

    accepts_nested_attributes_for :notifications_for_followed_topics,
                                  :notifications_for_private_topics,
                                  :messageboard_notifications_for_followed_topics
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
thredded-0.15.4 app/models/thredded/user_preference.rb
thredded-0.15.3 app/models/thredded/user_preference.rb
thredded-0.15.2 app/models/thredded/user_preference.rb
thredded-0.15.1 app/models/thredded/user_preference.rb
threddedDANIEL-0.14.5 app/models/thredded/user_preference.rb
thredded-0.14.4 app/models/thredded/user_preference.rb
thredded-0.14.3 app/models/thredded/user_preference.rb
thredded-0.14.2 app/models/thredded/user_preference.rb
thredded-0.14.1 app/models/thredded/user_preference.rb
thredded-0.14.0 app/models/thredded/user_preference.rb
thredded-0.13.8 app/models/thredded/user_preference.rb
thredded-0.13.7 app/models/thredded/user_preference.rb
thredded-0.13.6 app/models/thredded/user_preference.rb
thredded-0.13.5 app/models/thredded/user_preference.rb
thredded-0.13.4 app/models/thredded/user_preference.rb
thredded-0.13.3 app/models/thredded/user_preference.rb
thredded-0.13.2 app/models/thredded/user_preference.rb
thredded-0.13.1 app/models/thredded/user_preference.rb
thredded-0.13.0 app/models/thredded/user_preference.rb
thredded-0.12.4 app/models/thredded/user_preference.rb