Class: Spree::Admin::StockItemsController
- Inherits:
-
BaseController
- Object
- BaseController
- BaseController
- Spree::Admin::StockItemsController
- Defined in:
- app/controllers/spree/admin/stock_items_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/spree/admin/stock_items_controller.rb', line 13 def create variant = Variant.find(params[:variant_id]) stock_location = StockLocation.find(params[:stock_location_id]) stock_movement = stock_location.stock_movements.build(stock_movement_params) stock_movement.stock_item = stock_location.set_up_stock_item(variant) if stock_movement.save flash[:success] = (stock_movement, :successfully_created) else flash[:error] = Spree.t(:could_not_create_stock_movement) end redirect_to :back end |
#destroy ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/controllers/spree/admin/stock_items_controller.rb', line 28 def destroy stock_item.destroy respond_with(@stock_item) do |format| format.html { redirect_to :back } format.js end end |
#update ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/spree/admin/stock_items_controller.rb', line 6 def update stock_item.save respond_to do |format| format.js { head :ok } end end |