Class: Admin::ProductGroupsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/product_groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/admin/product_groups_controller.rb', line 18

def create
  respond_to do |format|
    format.html do

      @product_group = ProductGroup.new(post_params[:product_group])
      if @product_group.save
        redirect_to admin_product_groups_path, notice: t(:successfully_updated)
      else
        render action: 'new'
      end

    end
  end
end

#destroyObject



50
51
52
53
54
55
56
# File 'app/controllers/admin/product_groups_controller.rb', line 50

def destroy
  if @product_group.destroy
    redirect_to admin_product_groups_path, notice: t(:successfully_deleted)
  else
    respond_with @product_group
  end
end

#editObject



33
34
35
36
# File 'app/controllers/admin/product_groups_controller.rb', line 33

def edit
  @custom_fields = CustomField.order('name asc')
  respond_with @product_group
end

#indexObject



7
8
9
10
# File 'app/controllers/admin/product_groups_controller.rb', line 7

def index
  @product_groups = ProductGroup.order('name asc')
  respond_with @product_groups
end

#newObject



12
13
14
15
16
# File 'app/controllers/admin/product_groups_controller.rb', line 12

def new
  @product_group = ProductGroup.new
  @product_group.product_group_conditions.build
  respond_with @product_group
end

#updateObject



38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/admin/product_groups_controller.rb', line 38

def update
  respond_to do |format|
    format.html do
      if @product_group.update_attributes post_params[:product_group]
        redirect_to admin_product_groups_path, notice: t(:successfully_updated)
      else
        render action: 'edit'
      end
    end
  end
end