Class: Workarea::Admin::ShippingServicesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model

Methods included from Publishing

#allow_publishing!, #allow_publishing?, #set_publishing_options

Methods included from Visiting

#most_visited

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/workarea/admin/shipping_services_controller.rb', line 18

def create
  build_rules

  if @service.save

    flash[:success] = t('workarea.admin.shipping_services.flash_messages.created')
    redirect_to shipping_services_path
  else
    render :new
  end
end

#destroyObject



41
42
43
44
45
# File 'app/controllers/workarea/admin/shipping_services_controller.rb', line 41

def destroy
  @service.destroy
  flash[:success] = t('workarea.admin.shipping_services.flash_messages.removed')
  redirect_to shipping_services_path
end

#editObject



16
# File 'app/controllers/workarea/admin/shipping_services_controller.rb', line 16

def edit; end

#indexObject



6
7
8
# File 'app/controllers/workarea/admin/shipping_services_controller.rb', line 6

def index
  @services = Shipping::Service.all.page(params[:page])
end

#newObject



14
# File 'app/controllers/workarea/admin/shipping_services_controller.rb', line 14

def new; end

#showObject



10
11
12
# File 'app/controllers/workarea/admin/shipping_services_controller.rb', line 10

def show
  redirect_to edit_shipping_service_path(@service)
end

#updateObject



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

def update
  build_rules

  if @service.update_attributes(params[:service])
    flash[:success] = t('workarea.admin.shipping_services.flash_messages.saved')
    redirect_to shipping_services_path
  else
    render :edit
  end
end