Questions tagged [pry-rails]
Pry-rails refers to the runtime developer console Pry that is used as an alternative to the standard IRB shell for the programming language Ruby. Use this tag for questions related to the runtime developer console.
pry-rails
36
questions
1
vote
1
answer
82
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
286
views
"undefined method `pry'" error inside rails container although pry-rails gem is installed and required
I am running public ruby on rails web app docker image (gitlab) inside the container that I initialize with docker compose run --service-ports --detach [SERVICE_NAME] command.
My goal is to debug the ...
1
vote
1
answer
906
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 ...
1
vote
1
answer
617
views
How to show Rails ActiveRecord query time in Heroku pry rails console?
When I run an ActiveRecord query in my local console, I am shown both how long the query took to run (in ms) and the raw SQL that was generated from my ActiveRecord code. For example:
$ rails c
...
1
vote
3
answers
770
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):
...
0
votes
0
answers
101
views
Can I add lines of code to execute when I start or reload! a Pry session?
My main rails app has a MultiTenent feature. I need to run something like this:
MultiTenant.current_tenant = Company.find(9)
When I start every Pry session or when I reload!. Can I configure Pry ...
4
votes
1
answer
783
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 ...
1
vote
0
answers
336
views
Pry-rails appears to be corrupting my terminal, how can I fix this issues?
Hopefully someone can help me with this issue. I have noticed for a while, whilst using standard pry with Ruby, that occasionally pry will appear to become stuck in a loop, requiring me to kill the ...
2
votes
1
answer
85
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 ...
0
votes
1
answer
178
views
rails not updating session hash on ajax request without pry
I'm trying to develop a cart system(for a practice e-commerce project) on rails 6.
The code(explaination):
I have a link with class attribute "add_to_cart_link" then I use a jquery to select ...
2
votes
1
answer
343
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
1
answer
2k
views
Rails RSpec Pry "reload!"
ruby 2.3.1
rails (3.2.22.4)
rspec-rails (2.14.2)
pry-rails (0.3.2)
pry-byebug (3.6.0)
pry (0.10.4)
I am using a bit old version of Ruby and Rails.
I am running RSpec tests in the Ubuntu Terminal:
...
0
votes
0
answers
503
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 ...
0
votes
1
answer
206
views
Function Returning Different Values If Pry Debugger Statements Included
I'm experiencing a strange issue with a ruby function I wrote to remove unwanted items from a hash created by parsing a JSON string. The function will return what I am expecting when I have pry ...
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?