Skip to content

Instantly share code, notes, and snippets.

@ahmdrefat
Created October 21, 2012 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmdrefat/3926328 to your computer and use it in GitHub Desktop.
Save ahmdrefat/3926328 to your computer and use it in GitHub Desktop.
def get_basic_profile
bprofile = BasicProfile.find_by_user_id(current_user.id)
if bprofile.nil?
client = get_client
profile = client.profile(:fields => ["first-name", "last-name", "maiden-name", "formatted-name" ,:headline, :location, :industry, :summary, :specialties, "picture-url", "public-profile-url"])
basic_profile = profile.to_hash
basic_profile[:location] = basic_profile["location"]["name"]
new_basic_profile = BasicProfile.new(basic_profile)
new_basic_profile.user = current_user
new_basic_profile.save
new_basic_profile
else
bprofile
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment