Sha256: c0ddc16e0410bc82b1fd5a62c4e7e454699e66b2fcf5bfa6bacfca60bd082ada

Contents?: true

Size: 1.14 KB

Versions: 20

Compression:

Stored size: 1.14 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
      has_many :messageboard_preferences,
               class_name: 'Thredded::UserMessageboardPreference'
      has_many :messageboard_notifications_for_followed_topics,
               class_name: 'Thredded::MessageboardNotificationsForFollowedTopics'
      has_many :notifications_for_followed_topics,
               class_name: 'Thredded::NotificationsForFollowedTopics'
      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

20 entries across 20 versions & 1 rubygems

Version Path
thredded-1.1.0 app/models/thredded/user_preference.rb
thredded-1.0.1 app/models/thredded/user_preference.rb
thredded-1.0.0 app/models/thredded/user_preference.rb
thredded-0.16.16 app/models/thredded/user_preference.rb
thredded-0.16.15 app/models/thredded/user_preference.rb
thredded-0.16.14 app/models/thredded/user_preference.rb
thredded-0.16.13 app/models/thredded/user_preference.rb
thredded-0.16.12 app/models/thredded/user_preference.rb
thredded-0.16.11 app/models/thredded/user_preference.rb
thredded-0.16.10 app/models/thredded/user_preference.rb
thredded-0.16.9 app/models/thredded/user_preference.rb
thredded-0.16.8 app/models/thredded/user_preference.rb
thredded-0.16.7 app/models/thredded/user_preference.rb
thredded-0.16.6 app/models/thredded/user_preference.rb
thredded-0.16.5 app/models/thredded/user_preference.rb
thredded-0.16.4 app/models/thredded/user_preference.rb
thredded-0.16.3 app/models/thredded/user_preference.rb
thredded-0.16.1 app/models/thredded/user_preference.rb
thredded-0.16.0 app/models/thredded/user_preference.rb
thredded-0.15.5 app/models/thredded/user_preference.rb