Skip to content

Custom username on comments

Sterling Cobb edited this page Nov 4, 2013 · 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 "[email protected]" you can customize that by going into the config/initializers/commontator.rb file and change this line:

config.user_name_method = 'username'

Where 'username' is any method on the commeting class that you want displayed. For instance, it could be email or just name. If you want a first and last name, just make a full_name method :)

Clone this wiki locally