Skip to content

Custom username on comments

Dantemss edited this page Mar 5, 2014 · 2 revisions

If you are creating a comment and see "Anonymous" as the commentor and would like to customize what is displayed there ie. "Frank" or "example@gmail.com" 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 }
Clone this wiki locally