Class: Spree::Api::StockMovementsController

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

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/spree/api/stock_movements_controller.rb', line 19

def create
  authorize! :create, StockMovement
  @stock_movement = scope.new(stock_movement_params)
  if @stock_movement.save
    respond_with(@stock_movement, status: 201, default_template: :show)
  else
    invalid_resource!(@stock_movement)
  end
end

#indexObject



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

def index
  authorize! :index, StockMovement
  @stock_movements = paginate(scope.ransack(params[:q]).result)
  respond_with(@stock_movements)
end

#showObject



14
15
16
17
# File 'app/controllers/spree/api/stock_movements_controller.rb', line 14

def show
  @stock_movement = scope.find(params[:id])
  respond_with(@stock_movement)
end