Created
June 21, 2012 17:54
-
-
Save andrewwho/2967354 to your computer and use it in GitHub Desktop.
hurray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :images do | |
desc "populating user.image" | |
task :pull => :environment do | |
print "This task will pull FB images into user.image if user has fb authentications. Confirm? [y/n]: " | |
answer = $stdin.gets.chomp() | |
if answer == 'y' | |
# User.all.each do |u| | |
u = User.find(50) | |
if !u.authentications.blank? | |
# grab the image from facebook and store it in the cloud. | |
# remote_picture_url | |
# "https://graph.facebook.com/"+auth.uid+"/picture?type=small" | |
auth = u.authentications.find_by_provider('facebook') | |
u.remote_image_url = "https://graph.facebook.com/"+auth.uid+"/picture?type=large" | |
u.save! | |
else | |
puts u.username + " does not have facebook!" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment