Sha256: a72cdd45299dbbd381c9dfa584f5ce5d290006a4e3365e2869445d7fd348d6e7

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

#
# Manage the system configuration page
#
module CoreSystemConfigurationsController
  authorize_resource :system_configuration

  #
  # Edit the system configuration
  #
  def edit
    load_configuration
  end

  #
  # Update and log the system configuration changes
  #
  def update
    # @system_configuration.update_attributes_and_log! @current_admin_user, system_configuration_params
    SystemConfiguration.configuration.update! system_configuration_params
    flash[:info] = 'System Configuration Updated, sync job running in the background'
    Cron::SwitchboardSyncConfiguration.perform_later
    redirect_to system_configuration_path
  rescue StandardError => error
    log_controller_error error
    load_configuration
    render :edit
  end

  private

  #
  # Get the system configuration properties from the request
  #
  def system_configuration_params
    params.require(:system_configuration).permit(SystemConfiguration.allowed_param_names)
  end

  #
  # Load the current system configuration
  #
  def load_configuration
    @system_configuration = SystemConfiguration.configuration
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
web47core-0.1.11 lib/app/controllers/concerns/core_system_configuration_controller.rb