🖥

Semi-permanently remembers Rails | pry's input history (leaves the

2019/04/16に公開

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.

image

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.

environment

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

reference

Original by

Rails | pry の入力履歴を半永久的に記憶させる ( pry が終了しても履歴を残す ) [Mac OS X]

About

About this translattion

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-04-16

Discussion