sample_rails_tailwind/app/helpers/users_helper.rb
songtianlun cf76756f55 feat: add user index page and update navigation
- Implement users index action in UsersController
- Create view for displaying all users with gravatar
- Update header to link to users index
- Add styles for user list display

This commit introduces a new feature that allows logged-in users to
view a list of all registered users. It includes necessary
controller actions, view templates, and styling to improve the
user interface.
2025-01-05 01:59:05 +08:00

9 lines
309 B
Ruby

module UsersHelper
def gravatar_for(user, options = { size: 80 })
size = options[:size]
gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")
end
end