Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

byebug and web-console not working in view

In my Rails application, I am able to use byebug in controller.

However, neither adding byebug or console in view is helping me to get a debug console.

I am using Haml, thus it's not <% console %>. In other words, the lines (one of the two at-a-time) I used in the view are:

byebug
console

I haven't tried Pry or Pry-debug, but apparently they also don't work in views?

Am I using these gems incorrectly or is there another way to add debugs in views?

Thanks, Kumar.

like image 797
Kumar Avatar asked Mar 11 '16 13:03

Kumar


2 Answers

try doing - byebug on its own line

like image 194
bf34 Avatar answered Nov 02 '22 06:11

bf34


To expand on @bf34's answer, you may just need to tell haml that byebug is code that needs to be run. You can do this by preceding it with - (e.g. - byebug) as explained in the HAML reference

like image 25
Matt Avatar answered Nov 02 '22 04:11

Matt