2 class CustomersController < ApplicationController
5 # GET /customers/new.xml
7 @customer = Customer.new
10 format.html # new.html.erb
11 format.xml { render :xml => @customer }
18 @customer = Customer.new(params[:customer])
20 @exist_cust = Customer.find_by_mobile(@customer.mobile)
22 respond_to do |format|
24 flash[:notice] = '用户资料已经记录,快来给你的宠物起名字。'
25 format.html { redirect_to :controller => :pets, :action => :new, :customer => @customer}
26 format.xml { render :xml => @customer, :status => :created, :location => @customer }
28 format.html { render :action => "new" }
29 format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }
33 @customer = @exist_cust
34 flash[:notice] = '用户资料已经记录,快来给你的宠物起名字。'
35 redirect_to :controller => :pets, :action => :new, :customer => @customer