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



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

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



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

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