Ian Vaughan
Ian Vaughan

Reputation: 21311

No history for rails console

irb works fine, rails console doesnt!

~/.irbrc

require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
> irb
irb(main):002:0> a="test"
=> "test"
irb(main):003:0> exit
> cat ~/.irb-save-history
a="test"
exit
> rails c
Running via Spring preloader in process 6238
Loading development environment (Rails 6.1.5.1)
[1] pry(main)> b="test"
=> "test"
[2] pry(main)> exit
> cat ~/.irb-save-history
a="test"
exit

Upvotes: 0

Views: 462

Answers (1)

Vi.
Vi.

Reputation: 1012

If you're using pry, your history will be in ~/.pry_history. If that's not the case, you will find all your history in ~/.irb_history

EDIT: depending on the OS, you could have ~/.irb-history (dash, not underscore) file too. So the most updated file should be one of these.

Upvotes: 1

Related Questions