I'm trying to pull in user's profile avatars from twitter using these codes
Any idea how I need to fix this error message?
Here's what I'm using in the Users Helper
module UsersHelper
def twitteravatar_for(user, options = { size: 50 })
omniauth = request.env['omniauth.auth']
self.image = omniauth['info']['image'].sub("_normal", "_bigger")
gravatar_url = self.image
image_tag(gravatar_url, alt: user.name)
end
end
Then I'm trying to use this in view and pull the user's individual avatar
<%= link_to twitteravatar_for(feed_item.user), feed_item.user %>
Is it because I can't use request.env['omniauth.auth']
in helper?