Class: Spree::Api::StockMovementsController
- Inherits:
-
BaseController
- Object
- ActionController::Metal
- BaseController
- Spree::Api::StockMovementsController
show all
- Defined in:
- app/controllers/spree/api/stock_movements_controller.rb
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#map_nested_attributes_keys, #permitted_line_item_attributes, #set_jsonp_format
included
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/spree/api/stock_movements_controller.rb', line 17
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
|
#index ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/spree/api/stock_movements_controller.rb', line 6
def index
authorize! :read, StockMovement
@stock_movements = scope.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])
respond_with(@stock_movements)
end
|
#show ⇒ Object
12
13
14
15
|
# File 'app/controllers/spree/api/stock_movements_controller.rb', line 12
def show
@stock_movement = scope.find(params[:id])
respond_with(@stock_movement)
end
|