0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

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

Last updated at Posted at 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オープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?