Sha256: b9f7663fc230322e1a236c7eae0fc9559e95d6773b75d1fb9ed8c813f7c5536c

Contents?: true

Size: 639 Bytes

Versions: 9

Compression:

Stored size: 639 Bytes

Contents

module Thredded
  class PreferencesController < Thredded::ApplicationController
    helper_method :preference

    def edit
    end

    def update
      preference.update_attributes(preference_params)

      redirect_to :back, flash: { notice: 'Your preferences are updated' }
    end

    def preference
      @preference ||= MessageboardPreference
        .where(messageboard_id: messageboard.id, user_id: current_user.id)
        .first_or_create!
    end

    private

    def preference_params
      params
        .require(:messageboard_preference)
        .permit(:notify_on_mention, :notify_on_message, :filter)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
thredded-0.0.12 app/controllers/thredded/preferences_controller.rb
thredded-0.0.10 app/controllers/thredded/preferences_controller.rb
thredded-0.0.9 app/controllers/thredded/preferences_controller.rb
thredded-0.0.8 app/controllers/thredded/preferences_controller.rb
thredded-0.0.7 app/controllers/thredded/preferences_controller.rb
thredded-0.0.6 app/controllers/thredded/preferences_controller.rb
thredded-0.0.5 app/controllers/thredded/preferences_controller.rb
thredded-0.0.4 app/controllers/thredded/preferences_controller.rb
thredded-0.0.3 app/controllers/thredded/preferences_controller.rb