Create a gist now

Instantly share code, notes, and snippets.

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