From 6965101fa6d6220657ce3e55451ca8fdca599ed0 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Tue, 18 Oct 2011 12:29:07 -0700 Subject: [PATCH] fix some mistakes I made yesterday, check if the name field exsists before trying it --- app/models/profile.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index 8e7dd4976..d6baecce3 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -86,8 +86,10 @@ class Profile < ActiveRecord::Base 'location' => 'location', 'name' => 'full_name' } - if omniauth_user_hash['first_name'].blank? || omniauth_user_hash['last_name'].blank? - omniauth_user_hash['first_name'], omniauth_user_hash['last_name'] = omniauth_user_hash['name'].split + if(omniauth_user_hash['first_name'].blank? || omniauth_user_hash['last_name'].blank?) && omniauth_user_hash['name'].present? + first, last = omniauth_user_hash['name'].split + omniauth_user_hash['first_name'] ||= first + omniauth_user_hash['last_name'] ||= last end update_hash = Hash[omniauth_user_hash.map {|k, v| [mappings[k], v] }]