diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 2720e11f..03367073 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -60,7 +60,9 @@ class MyController < ApplicationController @user.pref.save @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) set_language_if_valid @user.language + @user.update_user_extensions() flash[:notice] = l(:notice_account_updated) + redirect_to my_account_path return end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6126e035..f45a0561 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -434,7 +434,18 @@ class UsersController < ApplicationController def user_fanslist end + + #william + def update_extensions(user_extensions) + user_extensions = params[:user_extensions] + unless user_extensions.nil? + user_extensions = UserExtensions.find_by_id(user_extensions.user_id) + + # user_extensions. + end + end + private def find_user diff --git a/app/models/user_extension.rb b/app/models/user_extension.rb deleted file mode 100644 index cdfad28c..00000000 --- a/app/models/user_extension.rb +++ /dev/null @@ -1,11 +0,0 @@ -class UserExtension < ActiveRecord::Base - attr_accessible :birthday, :brief_introduction, :fans_num, :finish_project_num, :follow_num, :gender, :good_num, :location, :occupation, :publish_requirement_num, :user_id, :work_experience, :zip_code - - belongs_to :user - validate :validate_user - - def validate_user - errors.add :user_id, :invalid if user.nil? || !user.active? || User.current != user_id - end - -end diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb new file mode 100644 index 00000000..f70cddad --- /dev/null +++ b/app/models/user_extensions.rb @@ -0,0 +1,19 @@ +class UserExtensions < ActiveRecord::Base + attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code + #this method was used to update the table user_extensions + def update_user_extensions(birthday=nil,brief_introduction=nil, + gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) + self.birthday = birthday + self.brief_introduction = brief_introduction + self.gender = gender + self.location = location + self.occupation = occupation + self.work_experience = work_experience + self.zip_code = zip_code + self.save + end + + def get_brief_introduction + return self.brief_introduction + end +end diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index c8367477..c99f918a 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -72,14 +72,14 @@
-<%= f.text_field :lastname, :required => true %>
+ ++ <%= f.text_field :brief_introduction, :required => true %> +
<%= f.text_field :mail, :required => true %>
diff --git a/app/views/tags/_show_projects.html.erb b/app/views/tags/_show_projects.html.erb index 9368d1c6..b4eb6f0a 100644 --- a/app/views/tags/_show_projects.html.erb +++ b/app/views/tags/_show_projects.html.erb @@ -1,7 +1,7 @@