Вопрос

I'm using the console in Ruby on Rails 3.1.1, and I'm finding its command history (up arrow) to be really flaky. I've run the commands p = Product.by_name 'Acme' and p.add_search_term('Snipe') several times today, across several console sessions.

Yet, when I reload the Ruby on Rails console, only the first one shows in my command history, not the second. Sometimes they are both there in the history after I reload the console. On top of that, I see commands in my history that are from several days ago after pressing up arrow only a few times. Is there some sort of configuration that I need to change or is this a bug?

  • Ruby on Rails 3.1.1`
  • Ruby 1.9.2p290`
  • Ubuntu 11.10`
Это было полезно?

Решение

From How To – Persist Rails or IRB Console Command History After Exit.

Create, or edit your ~/.irbrc file to include:

require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top