Class: Workarea::Admin::CountryExceptionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/workarea/admin/country_exceptions_controller.rb', line 16

def create
  if @country_exception.save
    flash.now[:error] = t('workarea.admin.country_exceptions.flash_messages.saved')
    redirect_to catalog_product_country_exceptions_path(@product)
  else
    @product.reload
    flash.now[:error] = t('workarea.admin.country_exceptions.flash_messages.create_error')
    render :new
  end
end

#destroyObject



39
40
41
42
43
44
# File 'app/controllers/workarea/admin/country_exceptions_controller.rb', line 39

def destroy
  @country_exception.destroy

  flash[:success] = t('workarea.admin.country_exceptions.flash_messages.deleted')
  redirect_to catalog_product_country_exceptions_path(@product)
end

#editObject



27
# File 'app/controllers/workarea/admin/country_exceptions_controller.rb', line 27

def edit; end

#indexObject



9
10
# File 'app/controllers/workarea/admin/country_exceptions_controller.rb', line 9

def index
end

#newObject



12
13
14
# File 'app/controllers/workarea/admin/country_exceptions_controller.rb', line 12

def new
  @country_exception = GlobalE::CountryException.new
end

#updateObject



29
30
31
32
33
34
35
36
37
# File 'app/controllers/workarea/admin/country_exceptions_controller.rb', line 29

def update
  if @country_exception.update_attributes(country_exception_params)
    flash[:success] = t('workarea.admin.country_exceptions.flash_messages.saved')
    redirect_to catalog_product_country_exceptions_path(@product)
  else
    flash.now[:error] = t('workarea.admin.country_exceptions.flash_messages.update_error')
    render :edit, status: :unprocessable_entity
  end
end