Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
savefbuid.rb
def savefbuid
user = current_user
fbuid = params[:fbuid]
fbaccess = params[:fbaccess]
user.fb_uid = fbuid
user.fbaccess = fbaccess
@graph = Koala::Facebook::GraphAPI.new(fbaccess)
@me = @graph.get_object("me")
if @me['username'].blank?
user.fbusername = @me['name']
un = @me['name']
else
user.fbusername = @me['username']
un = @me['username']
end
user.save!
respond_to do |format|
format.js do
render :json => {"username" => un}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.