Add failure block to create respond_override for creating products

This commit is contained in:
Rob H
2014-07-23 14:56:12 +10:00
parent 03273a76ad
commit c8ddf86a9f

View File

@@ -5,13 +5,17 @@ Spree::Admin::ProductsController.class_eval do
respond_to :json, :only => :clone
respond_override create: { html: { success: lambda {
if params[:button] == "add_another"
redirect_to new_admin_product_path
else
redirect_to '/admin/products/bulk_edit'
end
} } }
respond_override create: { html: {
success: lambda {
if params[:button] == "add_another"
redirect_to new_admin_product_path
else
redirect_to '/admin/products/bulk_edit'
end
},
failure: lambda {
render :new
} } }
#respond_override :clone => { :json => {:success => lambda { redirect_to bulk_index_admin_products_url+"?q[id_eq]=#{@new.id}" } } }
def product_distributions