How to filter stacktrace in byebug

Category: Ruby :: Published at: 12.10.2021

Sometimes simple debugging with byebug is not enough and you need to dive deeper.

If you need to get the stacktrace you can simply use command:


It will show you what is hapenning and which files and lines of code are affected into the current action.

The problem is, it can be painful to read it - dozens of useless lines and only couple of them are important now for you.

If you want to filter it for example to see only lines connected with your rails app, you can use command below:

caller.grep(/Users\/paweltrela\/Ruby\/test_project\/app/).each { |call| puts call }

This command will show you calls connected with your Rails project. Remember to escape slashes when pasting your project location!

- Click if you liked this article

Views: 344