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
23
24
25
# File 'app/controllers/spree/admin/stock_movements_controller.rb', line 17

def create
  @stock_movement = stock_location.stock_movements.build(stock_movement_params)
  if @stock_movement.save
    flash[:success] = flash_message_for(@stock_movement, :successfully_created)
    redirect_to admin_stock_location_stock_movements_path(stock_location)
  else
    render :new
  end
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