Can I get a Ruby on Rails console to remember the history of commands, mmm, better?

I use the console in Ruby on Rails 3.1.1 and I find its command history (up arrow) to be really flaky. I ran the p = Product.by_name 'Acme' and p.add_search_term('Snipe') several times today, in several console sessions.

However, when I restart the Ruby on Rails console, only the first, not the second, is displayed in my command history. Sometimes they are both present in the story after the console reboots. In addition, I see commands in my story that happen a few days ago after clicking the arrow only a few times. Is there some kind of configuration I need to change or is this a bug?

  • Ruby on Rails 3.1.1`
  • Ruby 1.9.2p290`
  • Ubuntu 11.10`
+54
ruby-on-rails-3 rails-console
May 05 '12 at 19:29
source share
1 answer

From How To - Persist Rails or the history of IRB console commands after the release .

Create or edit the ~/.irbrc file to include:

 require 'irb/ext/save-history' IRB.conf[:SAVE_HISTORY] = 200 IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history" 
+122
May 6 '12 at 2:17
source share



All Articles