Joe Guerra Joe Guerra - 5 months ago 36
Ruby Question

Commontator gem username

I'm using the Commontator gem and it's working fine. Unfortunately, the logged in user who adds a comment shows up as Anonymous. How do I use the username in my user model for Commontator?



From :

If you are creating a comment and see "Anonymous" as the commentor and would like to customize what is displayed there ie. "Frank" or "" you can customize that by going into the config/initializers/commontator.rb file and changing this line:

config.user_name_proc = lambda { |user| I18n.t('commontator.anonymous') }

For instance, if you have a 'full_name' method, you could change the above to:

config.user_name_proc = lambda { |user| user.full_name }