Class: FormLineItem

Inherits:
Object
  • Object
show all
Includes:
Forms::Models::Extension, Shop::Models::FormExtension
Defined in:
app/models/form_line_item.rb

Instance Method Summary collapse

Methods included from Shop::Models::FormExtension

included

Instance Method Details

#createObject

line_item:

process: add|update|remove


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/form_line_item.rb', line 8

def create
  @result ||= {}
  find_or_create_current_order
  
  case process
  when 'add'
    @result[:add]    = @order.add(line_item_item_id,line_item_quantity,line_item_item_type)
  when 'modify'
    @result[:modify] = @order.modify(line_item_id,line_item_quantity)
  when 'remove'
    @result[:remove] = @order.remove(line_item_id)
  end
  
  @result
end