36 questions
2
votes
2
answers
285
views
Paste multi lines in Rails console with pry
Problem: I cannot paste multi-line code as pry tries to execute every line.
Expected behavior:
[1] pry(main)> %w[a b c]
.map(&:to_sym)
=> [:a, :b, :c]
[2] pry(main)>
Actual behavior:
[1] ...
1
vote
1
answer
1k
views
How to disable Pry autocomplete?
I would like to disable autocomplete in Pry. How to do it?
I'm using it in Rails console(from Emacs/inf-ruby) and it is very slow and annoying in my legacy app.
Related question: Disable irb ...
2
votes
3
answers
867
views
How to copy multiple lines of code into byebug?
byebug doesn't seem to be able to handle multiple lines of code.
Example
I put byebug into the controller, and the next lines of code are (these could be anything, just an example here):
...
4
votes
1
answer
846
views
Immediately evaluate multiple lines of code at same time in rails console when using pry?
Suppose we have pry installed, open the rails console, and run
times = [1, 5, 10, 30, 72].sample(1)[0]
nums = *(1..72)
num_sample = nums.sample(times)
Evaluation stops after line 2 (since the output ...
2
votes
1
answer
91
views
Does pry cache local files for each terminal tab?
I'm working with a local library (gem), let's call it B, inside my rails application A (Rails version 6.0.2.2)
In A's Gemfile, I require B via:
gem 'B', path: '../B'
When I do rails c with pry, I ...
2
votes
1
answer
369
views
How is the ls command in Pry able to accept -l as an argument?
I recently discovered that ls in pry can take an argument like so: ls -l.
My initial question is what the -l part actually is - it is clearly not a string or symbol, and there is no local variable ...
0
votes
0
answers
534
views
rails-pry failure to create breakpoint: before_session hook failed: NoMethodError: undefined method `chomp' for nil:NilClass
I'm using rails-pry to create a breakpoint with a binding.pry statement. This has worked just fine for just about ever. However now there's this fun new error message I'm not even sure how to being ...
1
vote
1
answer
1k
views
How to install pry/pry-rails globally for all projects?
How can replace irb and rails console with pry/pry-console globally for every project without having to include it in a project?
0
votes
2
answers
2k
views
Rails params.nil? if else
I have this simple rails code and something weird is happening. As you can see params.nil? is true and it's still calling the else part. What am I missing here?
Pry Session
5: def ...
1
vote
1
answer
1k
views
Pry Rails on docker not working
I tried the approach with tty: true stdin_open: true inside docker-compose.yml and attaching to the container id (following http://www.chris-kelly.net/2016/07/25/debugging-rails-with-pry-within-a-...
1
vote
1
answer
2k
views
There was an error while trying to load the gem 'pry-rails'
I am not familiar with Ruby, but I am anyway trying to install and test iQvoc ( https://github.com/innoq/iqvoc ).
After some initial problems I managed to install it with heroku.
I am trying now to ...
3
votes
3
answers
1k
views
How to hide a column in pry / rails output
I have an image blob written to a field in the db, but I don't want to see that output in a console when I view the user object.
I don't need the output changed or modified for the functioning of the ...
6
votes
1
answer
3k
views
How to correctly set up Pry in Rails 4.2
I'm confused about which gems need to be installed to correctly run Pry in a Rails 4.2 project. I seemed to be doing fine until recently. For some reason, binding.pry now seems to spit up whenever I ...
1
vote
1
answer
2k
views
Why `binding.pry` halts at the wrong place?
For some reason when I set a breakpoint using binding.pry, the program ends up halting at a totally different (and alien looking!) place. Am I doing it wrong?
Gemfile (shortended)
gem "rails", "~>...
4
votes
2
answers
1k
views
NoMethodError in pry-stack_explorer when using rails console
I am using pry for rails console.
Whenever I evaluate some value in console, NoMethodError is raised in bindings_equal?, that is a method of pry-stack_explorer gem. The input and output is as ...
5
votes
2
answers
2k
views
Rails console error: Error loading ~/.pryrc: Command: `continue` not found
When I use the rails console on my current laptop (on any rails project), I get the following error when the console starts up.
Rails console error: Error loading ~/.pryrc: Command: `continue` not ...
2
votes
2
answers
1k
views
How can I set my Pry prompt to be the current timestamp?
When I put the following line into ~/.pryrc it doesn't work as expected:
Pry.config.prompt_name = Time.now.to_s
Every prompt is equal to the time that Pry was launched.
How do I update the prompt ...
3
votes
0
answers
118
views
I'm using Pry, specifically Remote-Pry, and when in console, I press back, an "Exit" prompts
So regardless of my console history, if I'm in a pry session, and if I press the up stroke, it should show what my last command was. Instead, it shows exit, and will execute exit if I press enter.
...