I have this code I use to get avatars from Facebook...
if auth.info.image.present?
user.update_attribute(:avatar, URI.parse(auth.info.image))
end
I actually think the cleanest way of handling this is directly requesting the avatar through https. To do that, just use
https://graph.facebook.com/672086173/picture?type=square
instead of
http://graph.facebook.com/672086173/picture?type=square
If you're using omniauth-facebook, you'll need to specify secure_image_url: true in your omniauth initializer to generate that url. Like so:
config.omniauth :facebook, "XXXX", "XXXX",
image_size: { width: 500, height: 500 },
secure_image_url: true
Your omniauth initializer should be in your config/initializers directory, probably called omniauth.rb or devise.rb if you're using it together with devise.