Reputation: 89
User
model has AvatarUploader
mounted which processes avatar upload via Devise
. And the response is fine:
"avatar": {
"url": "http://185.48.228.95/uploads/user/avatar/avatar.png"
}
But when User registers via Facebook (Koala
gem) his profile picture gets processed by Carrierwave (I do not want this).
Users controller part where I set avatar for Facebook registration:
image = @graph.get_object("me?fields=picture.type(large)")
avatar = image['picture']['data']['url'].to_s
@user["avatar"] = avatar
Which works fine. Bit some why it gets processed by Carrierwave AvatarUploader and gives current response. Which is not valid URL.
"avatar": {
"url": "http://185.48.228.95/uploads/user/avatar/https%3A/scontent.xx.fbcdn.net/v/t1.0-1/p200x200/11133815_976100819074773_1891085821809120990_n.jpg%3Foh%3D3bd392a5fdb9c5f1e3e6b01b8d47a1c0%26oe%3D590010A0"
}
How do I make it work so it sets the correct FB avatar link?
Upvotes: 0
Views: 78
Reputation: 89
Turned out Carrierwave has its helper for such purposes
@user.remote_avatar_url = image['picture']['data']['url']
Upvotes: 1