Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby debugger won't step over

using ruby-debug in rspec (through rspec -d), the debugger refuses to step over statements when I execute "next"

It seems to always step into the statement

debugger
params[:appointment][:user_id] = 
  User.where(email: appointment_params[:user_id]).pluck(:id).first if appointment_params[:user_id].to_i == 0
params[:appointment][:country_id] = 
  Country.where(name: appointment_params[:country_id]).pluck(:id).first if appointment_params[:country_id].to_i == 0

@appointment = Appointment.new(appointment_params)

when I hit "n" and press enter, it steps into the User.where statement

I have no idea what might be causing this, any ideas?

like image 489
lostinplace Avatar asked Sep 09 '26 15:09

lostinplace


1 Answers

You most likely shouldn't be using ruby-debug and should upgrade to a more recent debugger.

Switch to debugger if you're using ruby 1.9.x or to byebug if using ruby 2.x and your problem should be gone. If you switch to byebug, don't use the -d flag, it will only affect performance and it doesn't provide any benefits.

like image 189
deivid Avatar answered Sep 12 '26 04:09

deivid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!