Enable commands history on rails console and irb
In order to enable commands history on rails console or irb you can just add the following to your ~/.irbrc file:
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = '~/.irb-history'
So if you close your rails console or irb the history is persisted. So next time just use the arrows UP/DOWN to get your history back.