Class: Spree::Admin::StockMovementsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/stock_movements_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
# File 'app/controllers/spree/admin/stock_movements_controller.rb', line 17

def create
  @stock_movement = stock_location.stock_movements.build(stock_movement_params)
  @stock_movement.save
  flash[:success] = flash_message_for(@stock_movement, :successfully_created)
  redirect_to admin_stock_location_stock_movements_path(stock_location)
end

#editObject



24
25
26
# File 'app/controllers/spree/admin/stock_movements_controller.rb', line 24

def edit
  @stock_movement = StockMovement.find(params[:id])
end

#indexObject



7
8
9
10
11
# File 'app/controllers/spree/admin/stock_movements_controller.rb', line 7

def index
  @stock_movements = stock_location.stock_movements.recent.
    includes(:stock_item => { :variant => :product }).
    page(params[:page])
end

#newObject



13
14
15
# File 'app/controllers/spree/admin/stock_movements_controller.rb', line 13

def new
  @stock_movement = stock_location.stock_movements.build
end