# HG changeset patch # User luisf # Date 1291318024 0 # Node ID aedfe093ec32761ae14ef3a9c65d6b7fc8212621 # Parent cf39b52d24b49cf027cb913c4889635eaedebf9e Now correctly creates a new user with the description diff -r cf39b52d24b4 -r aedfe093ec32 app/controllers/users_controller.rb --- a/app/controllers/users_controller.rb Wed Dec 01 18:04:19 2010 +0000 +++ b/app/controllers/users_controller.rb Thu Dec 02 19:27:04 2010 +0000 @@ -72,7 +72,7 @@ render_404 end - def new + def new @notification_options = User::MAIL_NOTIFICATION_OPTIONS @notification_option = Setting.default_notification_option @@ -80,7 +80,7 @@ @auth_sources = AuthSource.find(:all) @ssamr_user_details = SsamrUserDetail.new - + end verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } @@ -98,12 +98,14 @@ @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') - @ssamr_user_details = @user.ssamr_user_detail - @ssamr_user_details.description = params[:ssamr_user_details][:description] - + @ssamr_user_details = SsamrUserDetail.new(params[:ssamr_user_details]) + + # associates the 2 objects + @user.ssamr_user_detail = @ssamr_user_details + if @user.save @user.pref.save - + @ssamr_user_details.save! @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) @@ -158,12 +160,11 @@ @ssamr_user_details.save! - if @user.save @user.pref.save @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) - if was_activatedd + if was_activated Mailer.deliver_account_activated(@user) elsif @user.active? && params[:send_information] && !params[:password].blank? && @user.auth_source_id.nil? Mailer.deliver_account_information(@user, params[:password]) diff -r cf39b52d24b4 -r aedfe093ec32 app/models/ssamr_user_detail.rb --- a/app/models/ssamr_user_detail.rb Wed Dec 01 18:04:19 2010 +0000 +++ b/app/models/ssamr_user_detail.rb Thu Dec 02 19:27:04 2010 +0000 @@ -1,5 +1,3 @@ class SsamrUserDetail < ActiveRecord::Base belongs_to :user - - validates_presence_of :user end