Sha256: c6d7be0e4fd334beef91d16d158bb60f179af75c1067ea7c91f702fe1cc2c854

Contents?: true

Size: 597 Bytes

Versions: 3

Compression:

Stored size: 597 Bytes

Contents

class Spree::Admin::ReviewSettingsController < Spree::Admin::BaseController
  before_filter :process_unset_checkboxes, only: [:update]

  def update
    Spree::Reviews::Config.set(params[:preferences])

    respond_to do |format|
      format.html do
        redirect_to edit_admin_review_settings_path
      end
    end
  end

  def process_unset_checkboxes
    # workaround for unset checkbox behaviour
    params[:preferences] ||= {}
    Spree::ReviewsConfiguration.boolean_preferences.each do |sym|
      params[:preferences][sym] = false if params[:preferences][sym].blank?
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
solidus_reviews-1.0.0 app/controllers/spree/admin/review_settings_controller.rb
jiffyshirts_spree_reviews-2.3.1.2 app/controllers/spree/admin/review_settings_controller.rb
jiffyshirts_spree_reviews-2.3.1.1 app/controllers/spree/admin/review_settings_controller.rb