I am using devise with omniauth facebook. I upload avatars for people that are not signing in with facebook with carrierwave, with the AvatarUploader.
But when I try fetching the avatar from the facebook user, it does not save - user.avatar = auth.info.image does not save, and after signing in equals nil.
Why is that and how can I fix it? Thanks in advance.
def self.from_omniauth(auth)
where(auth.slice(:provider, :uid)).first_or_create do |user|
user.provider = auth.provider
user.uid = auth.uid
user.email = auth.info.email
user.avatar = auth.info.image
end
end
Have you tried this?
In your method, change the line
user.avatar = auth.info.image
to
user.remote_avatar_url = auth.info.image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With