How To Persist Rails or IRB Console Command History After Exit

Sick of not having Ubuntu rails or irb terminal not saving your command history after exiting the console? Try this little trick to fix it up!

Append into your ~/.irbrc the following

require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"

You will notice the extra bit at the top of my ~/.irbrc, that makes sure that SQL is outputted as I type commands. Good for debugging.

Now enjoy your rails history!