byebug

How to copy multiple lines of code into byebug?

生来就可爱ヽ(ⅴ<●) 提交于 2020-12-27 05:59:25
问题 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): payment_intent = Stripe::PaymentIntent.create({ payment_method_types: ['card'], amount: @amount_minor_unit, currency: @currency, application_fee_amount: 123, # STODO transfer_data: { destination: @star.stripe_account, }, }) But it does this: If the code is edited so it's on one single line, it succeeds:

How to copy multiple lines of code into byebug?

孤街醉人 提交于 2020-12-27 05:59:06
问题 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): payment_intent = Stripe::PaymentIntent.create({ payment_method_types: ['card'], amount: @amount_minor_unit, currency: @currency, application_fee_amount: 123, # STODO transfer_data: { destination: @star.stripe_account, }, }) But it does this: If the code is edited so it's on one single line, it succeeds:

Pry-Remote not triggered Rails 4

与世无争的帅哥 提交于 2019-12-31 02:14:26
问题 Problem: After upgrading to Rails 4 in another branch and trying the solution that worked last time Pry-Remote with Pow on Rails 4 . I'm still finding difficulty with the new Rails 4 and Pry Debugger. What's I'm running: rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/] ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14] Rails 4.2.4 Pry version 0.10.2 on Ruby 2.2.3 # Debugging gem 'pry' gem 'pry-byebug' gem 'pry-stack

Got failure in integration testing of rails

百般思念 提交于 2019-12-25 00:05:23
问题 I was developing sample project of Rails tutorial (M. Hartl) but at the end of chapter 9 I got failure for integration testing. Assertion of test is like below: assert_select 'a[href=?]', user_path(user), text: user.name Body of error is: FAIL["test_index_as_admin_including_pagination_and_delete_links", UsersIndexTest, 2016-01-25 23:03:39 +0330] test_index_as_admin_including_pagination_and_delete_links#UsersIndexTest (1453750419.70s) Expected at least 1 element matching "a[href="/users

Breakpoints with pry-byebug don't trigger in the console

给你一囗甜甜゛ 提交于 2019-12-24 00:44:32
问题 I'm trying to use pry and pry-byebug to step through the execution of some code in a Rails console. I started the console with pry -r ./config/environment I then set a breakpoint: break Foo#bar Then make a new Foo and call bar on it: Foo.new.bar I expected step into Foo#bar , but instead the method just executed normally. Is there some way to get this workflow to work? 回答1: I found the answer: the debugger is not re-entrant. So you need to do this: [1] pry(main)> binding.pry [1] pry(main)>

byebug, next into application code only

邮差的信 提交于 2019-12-23 22:20:15
问题 When I press n (or type next ) in a Rails app, very often I get into a gem's methods that I'm not interested in, and I have to press n lots of times just to continue execution. Is there a way, beside filling my code with byebug calls, to just stay in my app's frames? Any tips? 回答1: I use c n to continue to a particular line n . Byebug will run at full-speed, then stop at the line you gave it. That means that gems or not, they won't be noticed by you as they'll be processed at high-speed. The

How to use Byebug with a remote process (e.g., pow)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 08:12:57
问题 How do I connect to a remote debugging instance of Byebug (for use with Pow, etc)? 回答1: Joseph's answer was good but confusing in some small ways. He places the starting of the byebug server in config/environments/development.rb , when it would be better in an initializer. Additionally the exporting of the environment variable go in .powenv or .powrc . This is how I got it to work. In your gemfile: gem 'byebug' On the command line: bundle install If you are using Pow, add the following to

How to use Byebug with a remote process (e.g., pow)

不羁岁月 提交于 2019-12-20 08:11:18
问题 How do I connect to a remote debugging instance of Byebug (for use with Pow, etc)? 回答1: Joseph's answer was good but confusing in some small ways. He places the starting of the byebug server in config/environments/development.rb , when it would be better in an initializer. Additionally the exporting of the environment variable go in .powenv or .powrc . This is how I got it to work. In your gemfile: gem 'byebug' On the command line: bundle install If you are using Pow, add the following to

In rails from byebug, how can I view the output of the session variable as a string, displaying only part of it?

对着背影说爱祢 提交于 2019-12-13 08:36:42
问题 In rails from byebug, how can I view the output of the session variable as a string, displaying only part of it? I can view the output of the session variable from the console but it is really long. If I could put that in a string and do e.g. thestr[1,100] . then that'd be ok. But I can't see how to get it into a string. ~/rubymac/cookiesandsessions/sessiontest1$ rails s => Booting Puma => Rails 5.2.3 application starting in development => Run `rails server -h` for more startup options Puma

Pry Remote / ByeBug next goes into Teardown

假装没事ソ 提交于 2019-12-12 03:18:49
问题 So I've decided to split my last post since the bug is Related to ByeBug more than to Pry-Remote (I think). Last post URL: Pry-Remote not triggered Rails 4 Problem: When typing Next in Pry-Remote, ByeBug acts unexpectedly and goes to "teardown". Also created an ByeBug Issue: https://github.com/deivid-rodriguez/pry-byebug/issues/78 What I am running: gem 'pry-byebug', '=1.3.3' gem 'pry-stack_explorer' gem 'pry-rails' gem 'pry-remote' pry (0.10.2) coderay (~> 1.1.0) method_source (~> 0.8.1)