samedi 11 avril 2015

How to get graph.facebook profile image in view?

When I put this: <%= @user.name %> <%= @user.image %> I get this: Anthony Galli http://ift.tt/1yg0bLV


But instead of the URL how can I get the actual image for users?


I promise I spent 30 min on this and I've yet to find an answer :/ I tried variations of image_tag.



def self.from_omniauth(auth)
where(provider: auth.provider, uid: auth.uid).first_or_initialize.tap do |user|
user.provider = auth.provider
user.image = auth.info.image
user.uid = auth.uid
user.name = auth.info.name
user.oauth_token = auth.credentials.token
user.oauth_expires_at = Time.at(auth.credentials.expires_at)
user.password = (0...8).map { (65 + rand(26)).chr }.join
user.email = (0...8).map { (65 + rand(26)).chr }.join+"@mailinator.com"
user.save!
end
end

Aucun commentaire:

Enregistrer un commentaire