Sha256: c26291ddade8e7feb7c5fe1277c8e3f765c6da7118bae360d0380c7d80c9e49f

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true
module Thredded
  class UserPreference < ActiveRecord::Base
    belongs_to :user, class_name: Thredded.user_class, 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

    accepts_nested_attributes_for :notifications_for_followed_topics,
                                  :notifications_for_private_topics,
                                  :messageboard_notifications_for_followed_topics
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thredded-0.10.1 app/models/thredded/user_preference.rb
thredded-0.10.0 app/models/thredded/user_preference.rb
thredded-0.9.4 app/models/thredded/user_preference.rb
thredded-0.9.3 app/models/thredded/user_preference.rb
thredded-0.9.2 app/models/thredded/user_preference.rb
thredded-0.9.1 app/models/thredded/user_preference.rb