mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add our own JSON handling actions for update and delete. Spree no longer does this for us.
This commit is contained in:
committed by
Rob Harrington
parent
73abb93737
commit
1170897587
@@ -34,6 +34,27 @@ Spree::Admin::LineItemsController.class_eval do
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
respond_to do |format|
|
||||
format.html { render_order_form }
|
||||
format.json {
|
||||
if @line_item.update_attributes(params[:line_item])
|
||||
render nothing: true, status: 204 # No Content, does not trigger ng resource auto-update
|
||||
else
|
||||
render json: {errors: @line_item.errors}, status: 412
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@line_item.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render_order_form }
|
||||
format.json { render nothing: true, status: 204 } # No Content
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
Reference in New Issue
Block a user