app/helpers/guts/users_helper.rb in guts-2.1.0 vs app/helpers/guts/users_helper.rb in guts-3.0.0

- old
+ new

@@ -1,14 +1,16 @@ module Guts # View helpers for users module UsersHelper # Gets the user's gravatar # @param [Object] user the user's object + # @param [Integer] size the size to fetch # @return [String] the image HTML # @note Sets a class of `gravatar` to the image HTML - def gravatar_for(user) + def gravatar_for(user, size = nil) gravatar_id = Digest::MD5.hexdigest user.email.downcase gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}" + gravatar_url << "?s=#{size}" unless size.nil? image_tag gravatar_url, alt: user.name, class: 'gravatar' end end end