Class: Crm::Items::CustomMatsController

Inherits:
CrmController
  • Object
show all
Defined in:
app/controllers/crm/items/custom_mats_controller.rb

Overview

Controller: custom mats.

Instance Method Summary collapse

Instance Method Details

#createObject

Creates a custom mat item from custom_mat_params.



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/crm/items/custom_mats_controller.rb', line 11

def create
  authorize!(:create, Item)
  @custom_mat = Item::CustomMatCreator.new(custom_mat_params)

  if (@item = @custom_mat.save)
    flash[:info] = "Custom mat item #{@item.sku} has been created."
    redirect_to @item
  else
    render action: 'new', status: :unprocessable_content
  end
end

#newObject

Renders the form for a new custom mat item.



5
6
7
8
# File 'app/controllers/crm/items/custom_mats_controller.rb', line 5

def new
  authorize!(:create, Item)
  @custom_mat = Item::CustomMatCreator.new
end