changeset 185:594ed6aef7bd feature_55

fixed issue with users with no entry in the ssamr_user_details_table. added javascript for those users in the my/account view.
author luisf
date Thu, 03 Feb 2011 15:31:33 +0000
parents 0d3dd7562e6a
children 752184172a34 f9fe5ef6156e
files app/controllers/my_controller.rb app/controllers/users_controller.rb app/views/my/account.rhtml
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/my_controller.rb	Thu Feb 03 15:15:39 2011 +0000
+++ b/app/controllers/my_controller.rb	Thu Feb 03 15:31:33 2011 +0000
@@ -54,8 +54,6 @@
     @pref = @user.pref
     @ssamr_user_details = @user.ssamr_user_detail
     
-    @selected_institution_id = @ssamr_user_details.institution_id.to_i
-    
     if request.post?
       @user.attributes = params[:user]
       @user.mail_notification = params[:notification_option] || 'only_my_events'
@@ -65,8 +63,10 @@
       if @user.ssamr_user_detail == nil
         @ssamr_user_details = SsamrUserDetail.new()
         @user.ssamr_user_detail = @ssamr_user_details
+        @selected_institution_id = NULL
       else
         @ssamr_user_details = @user.ssamr_user_detail
+        @selected_institution_id = @ssamr_user_details.institution_id.to_i
       end
 
 
--- a/app/controllers/users_controller.rb	Thu Feb 03 15:15:39 2011 +0000
+++ b/app/controllers/users_controller.rb	Thu Feb 03 15:31:33 2011 +0000
@@ -140,7 +140,11 @@
     
     @ssamr_user_details = @user.ssamr_user_detail
     
-    @selected_institution_id = @user.ssamr_user_detail.institution_id.to_i    
+    if @user.ssamr_user_detail == nil
+      @selected_institution_id = nil
+    else
+      @selected_institution_id = @user.ssamr_user_detail.institution_id.to_i    
+    end
     
     @auth_sources = AuthSource.find(:all)
     @membership ||= Member.new
--- a/app/views/my/account.rhtml	Thu Feb 03 15:15:39 2011 +0000
+++ b/app/views/my/account.rhtml	Thu Feb 03 15:31:33 2011 +0000
@@ -1,4 +1,6 @@
 <%= javascript_include_tag "ssamr_institutions" %>
+<%= javascript_include_tag "ssamr_registration" %>
+
 
 
 <div class="contextual">