Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to I start a rails console with pry turned off?

Sometimes I have reason to want to start the rails console as an irb repl rather than pry (as awesome as pry is). It will default to pry because pry has in the Gemfile. Hows is that done nowadays?

I think there used to be a --irb option when running rails console but that seems to be gone now. I get a deprecation error message when I try it.

More details

If I just run "rails console" it takes me to pry.

If I run "rails console -irb=irb":

$ rails c -irb=irb                                                                                                                                                                         
--irb option is no longer supported. Invoke `/your/choice/of/ruby script/rails console` instead

Relevent lines from my Gemfile:

gem 'rails', '3.2.18'
gem 'pry-rails'
gem 'pry-plus'
like image 484
Greg Malcolm Avatar asked Aug 05 '14 18:08

Greg Malcolm


People also ask

How do I quit pry?

To exit everything, use: exit! This should ignore all proceeding bindings. This also kills the server at the same time.

What is binding pry in rails?

Calling binding. pry is essentially 'prying' into the current binding or context of the code, from outside your file. So when you place the line binding. pry in your code, that line will get interpreted at runtime (as your program is executed).

How do I exit bin rails console?

Starting a Rails console session To exit the console, type: quit .


1 Answers

Launching pry when calling rails console or rails c is set up by the pry-rails gem. If you look in the pry-rails issues there is one that describes a solution.

Define the environment variable DISABLE_PRY_RAILS as 1.

So you can call rails console without pry with:

DISABLE_PRY_RAILS=1 rails c
like image 175
11 revs, 10 users 40% Avatar answered Sep 21 '22 08:09

11 revs, 10 users 40%