Class: Workarea::Admin::Listrak::ConfigurationsController

Inherits:
Admin::ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/admin/listrak/configurations_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



5
6
7
8
9
# File 'app/controllers/workarea/admin/listrak/configurations_controller.rb', line 5

def edit
  @configuration = ListrakConfigurationViewModel.new(
    Workarea::Listrak.configuration
  )
end

#updateObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/workarea/admin/listrak/configurations_controller.rb', line 11

def update
  configuration = Workarea::Listrak.configuration
  if configuration.update_attributes(configuration_params)
    redirect_to admin.edit_listrak_configuration_path, flash: { success: t('workarea.admin.listrak_configuration.edit.flash_messages.updated') }
  else
    flash[:error] = t('workarea.admin.listrak_configuration.edit.flash_messages.save_error')
    @configuration = ListrakConfigurationViewModel.new(configuration)
    render :edit, status: :unprocessable_entity
  end
end