I have gone through this railscast on Gravatars and i now have the below helper method in my application helper.
module ApplicationHelper
def avatar_url(user)
gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
"http://gravatar.com/avatar/#{gravatar_id}.png?s=200"
end
end
and i have this in my view
<%= image_tag avatar_url(user) %>
how can i modify the helper so it will accept a size option that changes the s=200 to the size specified?
Thanks
module ApplicationHelper
def avatar_url(user, size)
gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
end
end
Then call:
<%= image_tag avatar_url(user, 200) %>
You can also check Michael Hartl's guide.