app/models/user.rb
# Return true if there's a gravatar for this user
Return true if there's a gravatar for this user
Return true if there ' s a gravatar for this user
def gravatar_exists
    response = HTTParty.head(lookup_gravatar_url + '?d=404')
    response.code == 200
  end
def gravatar_exists response = HTTParty . head ( lookup_gravatar_url + '?d=404' ) response . code == 200 end
Return true if there's a gravatar for this user
Return true if there ' s a gravatar for this user
# The ?d=404 forces "not found" error code if none is found. # We use "head" because we don't need the full data at this point. # Assume we won't be redirected if something is found, so the # only thing we care about is if we get 200 (success) or not.