Devise + omniauth + carrierwave无法保存Facebook个人资料图片 [英] Devise + omniauth + carrierwave doesn't save facebook profile image
本文介绍了Devise + omniauth + carrierwave无法保存Facebook个人资料图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用带omniauth facebook的devise.我使用AvatarUploader为那些未使用carrierwave与Facebook登录的人上传了化身.
I am using devise with omniauth facebook. I upload avatars for people that are not signing in with facebook with carrierwave, with the AvatarUploader.
但是,当我尝试从facebook用户获取化身时,它不保存-user.avatar = auth.info.image
不保存,并且在登录等于nil
之后.
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
推荐答案
您是否尝试过这个?
在您的方法中,更改行
user.avatar = auth.info.image
到
user.remote_avatar_url = auth.info.image
这篇关于Devise + omniauth + carrierwave无法保存Facebook个人资料图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文