Semi-permanently remembers Rails | pry's input history (leaves the history even when pry finishes) [Mac OS X]

2334 단어 pry루비Rails

Solution



Put rb-readline with pry-rails.
 gem 'pry-rails' gem 'rb-readline' 
$ bundle install
Launch the Rails console.
$ bundle exec rails console
This is the solution! You can use the up and down keys on the keyboard to follow previous input history.



problem



pry doesn't record input history at all.

To be precise, it will remember during one session. exit , everything disappears at the next start.

By default all history settings are true. I also confirmed that .pry_history exists.
 Pry.config.history.should_save # => true Pry.config.history.should_load # => true Pry.config.history.file # => "/Users/yinaura/.pry_history" 

And despite the history being written to.pry_history. It can not only read.

It was useless to write load processing to .pryrc.
 Pry.history.load 

However. Manually run Pry.history.load after launching Pry.history.load to load the history. But it's too much trouble to do every time.

The solution is at the beginning.

환경


  • pry (0.10.3)
  • pry-rails (0.3.4)
  • rb-readline (0.5.3)
  • Rails 4.0.0
  • OSX Yosemit 10.10.4

  • 참조



  • Managing History · pry / pry Wiki

  • Problem loading history #1418

  • Original by



    Rails | pry의 입력 이력을 반영구적으로 기억시킨다 (pry가 종료해도 이력을 남긴다) [Mac OS X]

    About



    About this translation

    좋은 웹페이지 즐겨찾기