From 2000f1ddf637c28ad2994ad752497561fb43074f Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 17 Jun 2014 14:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E7=89=A9=E6=B3=A8=E5=86=8C=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E4=BF=A1=E6=81=AF=E4=BC=9A=E4=BF=9D=E5=AD=98=E4=B8=A4?= =?UTF-8?q?=E6=AC=A1=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 16 +++++++++------- app/controllers/my_controller.rb | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index af8487868..b5f6d7d57 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -144,14 +144,16 @@ class AccountController < ApplicationController #added by bai unless @user.id.nil? - ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => params[:no]) - unless params[:province].nil? || params[:city].nil? - ue.location = params[:province] - ue.location_city = params[:city] - ue.save - end + ue = @user.extensions + + ue.identity = params[:identity] + ue.technical_title = params[:technical_title] + ue.gender = params[:gender] + ue.student_id = params[:no] + ue.location = params[:province] + ue.location_city = params[:city] + @user.save end - #end end end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index a87df4fef..9b169cb81 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -61,7 +61,7 @@ class MyController < ApplicationController end end - @se = @user.user_extensions ||= UserExtensions.new + @se = @user.extensions @se.school_id = params[:occupation] if params[:occupation] @se.gender = params[:gender] @se.location = params[:province] if params[:province]