Command history in the Rails console on top of PuTTY

Using script / console in rails 2.3.12 on top of PuTTY. When I press the up arrow to access the last command I wrote, instead of raising a command, it simply prints the weird string "^ [[A" to the terminal. Same thing with the other arrows ... the back arrow prints "^ [[D" and the straight arrow prints "^ [[C"

Hoping someone finds out these strange codes and can tell me how to shoot correctly. Is this a problem with configuring PuTTY?

+1
source share
2 answers

The up-arrow function is provided by readline . Usually when Ruby is built. / configure automatically detects readline libraries and builds ruby โ€‹โ€‹mappings with them. Sometimes this does not work, and when creating Ruby you need to install new libraries or configure configure --with-readline-dir. irb and rails-console just use the readline features of ruby โ€‹โ€‹stdlib, a soy process problem, it is likely that your ruby โ€‹โ€‹build did not detect and bind readline.

I suggest you explore other SO issues related to creating ruby โ€‹โ€‹with readline to see if one of them provides guidance for your version of ruby โ€‹โ€‹and your OS.

+1
source

I used this and it worked for me with JRuby 1.6.7 and Rails 2.3.8 (see link for original solution)

It appears that bundler does not allow the irb console to use readline. You can get around this by putting the following line in .irbrc , which will force irb to use readline:

 IRB.conf[:USE_READLINE] = true 

as suggested here

Starting the rail console using the bundle command

hope this helps.

0
source

All Articles