diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index 262f7ea..2fa55c0 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -11,8 +11,9 @@ class ProfileEditorController < MyProfileController # edits the profile info (posts back) def edit if request.post? - profile.info.update_attributes(params[:info]) - redirect_to :action => 'index' + if profile.info.update_attributes(params[:info]) + redirect_to :action => 'index' + end else @info = profile.info render :action => @info.class.name.underscore diff --git a/app/models/person.rb b/app/models/person.rb index 5b9eaa1..eb87b84 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -103,4 +103,8 @@ class Person < Profile before_create :set_default_environment hacked_after_create :insert_default_homepage_and_feed + def name + person_info.name || self[:name] + end + end diff --git a/app/models/user.rb b/app/models/user.rb index e6ae5c0..d6f1c48 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -106,6 +106,10 @@ class User < ActiveRecord::Base save! unless new_record? end + def name + person.name + end + protected # before filter def encrypt_password diff --git a/app/views/profile_editor/organization_info.rhtml b/app/views/profile_editor/organization_info.rhtml index 1b019dc..b51ef8d 100644 --- a/app/views/profile_editor/organization_info.rhtml +++ b/app/views/profile_editor/organization_info.rhtml @@ -1,3 +1,6 @@ +