module UsersHelper
    # Get the gravatar picture of a user.
    # This take an user object as parameter.
    def gravatar_for user, options = { size: 200 }
        userEmail = user[:email].strip.downcase
        size = options[:size]
        gravatar_id = Digest::MD5::hexdigest(userEmail)
        gravatar_url = "https://www.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
    end
end

module UsersHelper
    # Get the gravatar picture of a user.
    # This take an user object as parameter.
    def gravatar_for user, options = { size: 200 }
        userEmail = user[:email].strip.downcase
        size = options[:size]
        gravatar_id = Digest::MD5::hexdigest(userEmail)
        gravatar_url = "https://www.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
    end

    def display_avatar(user, options = { size: 200, type: nil, title: user.name})
        if user.avatar.file? == true
            image_tag(user.avatar.url(options[:type]), class: "circle avatar-pic")
        else
            userEmail = user[:email].strip.downcase
            size = options[:size]
            gravatar_id = Digest::MD5::hexdigest(userEmail)
            gravatar_url = "https://www.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
            image_tag(gravatar_url, class: "circle avatar-pic")
        end
    end
end

Create a more advance new helper for display an avatar picture
Create a more advance new helper for display an avatar picture

This helper can verifiy if a user have a picture in the db and return it, but if not the helper will return the gravatar picture