问题
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
回答1:
Have you tried this?
In your method, change the line
user.avatar = auth.info.image
to
user.remote_avatar_url = auth.info.image
来源:https://stackoverflow.com/questions/19868830/devise-omniauth-carrierwave-doesnt-save-facebook-profile-image