validate error

This commit is contained in:
Aung Myo
2017-06-13 12:04:55 +06:30
parent 9e4c8cef68
commit ee54f1cdd3
6 changed files with 29 additions and 42 deletions

View File

@@ -14,9 +14,9 @@ class Crm::CustomersController < BaseCrmController
#@crm_customers = Customer.all
@crm_customer = Customer.new
# puts @crm_customer.valid?
if flash["errors"]
@crm_customer.valid?
end
# @membership = Customer.get_member_group
# if @membership["status"] == true
# @member_group = @membership["data"]
@@ -104,7 +104,9 @@ class Crm::CustomersController < BaseCrmController
else
if params[:sale_id]
flash[:errors] = @crm_customers.errors
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'}
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
else
flash[:errors] = @crm_customers.errors
format.html { redirect_to crm_customers_path}
@@ -148,7 +150,8 @@ end
else
format.html { render :index }
flash[:errors] = @crm_customers.errors
format.html { redirect_to crm_customers_path}
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
end