Last Updated: April 21, 2017
·
252
· msz

Printing a welcome message (message of the day) in Rails console

To print a message when a Rails console is opened via rails console simply add

console do
    puts 'Message of the day'
end

inside a config block of an initializer. It can be either config/application.rb or per environment (config/environments/development.rb)

You can run any arbitrary code in there as well!