Class: Spree::Api::StockLocationsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::StockLocationsController
- Defined in:
- app/controllers/spree/api/stock_locations_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/spree/api/stock_locations_controller.rb', line 22 def create :create, StockLocation @stock_location = Spree::StockLocation.new(stock_location_params) if @stock_location.save respond_with(@stock_location, status: 201, default_template: :show) else invalid_resource!(@stock_location) end end |
#destroy ⇒ Object
41 42 43 44 45 |
# File 'app/controllers/spree/api/stock_locations_controller.rb', line 41 def destroy :destroy, stock_location stock_location.destroy respond_with(stock_location, status: 204) end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/spree/api/stock_locations_controller.rb', line 4 def index :read, StockLocation @stock_locations = StockLocation. accessible_by(current_ability, :read). order('name ASC'). ransack(params[:q]). result @stock_locations = paginate(@stock_locations) respond_with(@stock_locations) end |
#show ⇒ Object
18 19 20 |
# File 'app/controllers/spree/api/stock_locations_controller.rb', line 18 def show respond_with(stock_location) end |
#update ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/spree/api/stock_locations_controller.rb', line 32 def update :update, stock_location if stock_location.update_attributes(stock_location_params) respond_with(stock_location, status: 200, default_template: :show) else invalid_resource!(stock_location) end end |