I'm working through the Michael Hartl Rails Tutorial and I'm getting a weird problem with the 'adding a Gravatar' section. I've checked the code against another implementation of a Gravatar in Rails I did for a different tutorial and don't see what's different.
Basically: the image doesn't appear, but if you right click the space and visit the URL it directs to the correct Gravatar page.
Code: (show.html.erb)
<%= gravatar_for @user %>
Code: (users_helper.rb)
def gravatar_for(user, options = { size: 50 })
size = options[:size]
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatars/#{gravatar_id}.png?s=#{size}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")
end
Totally stumped, know it's probably something really obvious that I'm missing, but from the book and the Gravatar website I seem to have gone about this right...
The url is wrong
gravatar_url = "https://secure.gravatar.com/avatars/#{gravatar_id}.png?s=#{size}"
correct version
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
singular form ".../avatar/...."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With