Class: Crm::Items::CustomMatsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/crm/items/custom_mats_controller.rb', line 7

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_entity
  end
end

#newObject



2
3
4
5
# File 'app/controllers/crm/items/custom_mats_controller.rb', line 2

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