6temes PRO said almost 2 years ago on Avatars :
`response.code != '302' ? true : false` could be just `response.code != '302'`

By the way, in order to use fewer resources in the server, something interesting could be to do the same in the front end using Stimulus.

David Kimura PRO said almost 2 years ago on Avatars :
  I agree on the response.code. I think that as I was speaking it and typing... It got typed out. 😀

I think that a full solution around this would be to have a background job which gets triggered on create and whenever the email address is updated to do the gravatar_exists? functionality and then update the user to populate a gravatar_url attribute on the user. Then we could check if the user.gravatar_url? and simply return the image_tag with the user.gravatar_url or display the initials.

Tiago Ameller PRO said over 1 year ago on Avatars :
I added this feature to a Rails 4.2.5 app.
In development, all worked at first attempt. But in production, gravatar never was returned.
I realized explicit require is needed. So, I had to add this line at top of app/presenters/avatar_presenter.rb
require 'net/http'

Found it, why not, in SO: https://stackoverflow.com/questions/42803138/why-rails-app-need-to-require-net-http-after-deploy-to-a-new-server

ternggio95 said over 1 year ago on Avatars :
Are you giving the wrong source code?

David Kimura PRO said over 1 year ago on Avatars :
  hmm. I'm not sure what happened there. At least the show notes is accurate.

partydrone PRO said over 1 year ago on Avatars :
Great episode. I think an interesting follow-up to this episode would be to implement it with the Null Object, Factory, or Adapter patterns. Then add a third option, like an avatar uploaded to the app. Or maybe even an avatar provided through a social media account if the app supports signing in with Facebook, Google, etc.

Login to Comment