1

I am trying to find a way to get a rails console for a program during runtime with all instantiated variables. The normal rails console does not have access to any instantiated variables of its respective running application. For example, when a rails application crashes during runtime, a webpage will load with the error listed in red text, a snippet of the code where the error was raised, and a console at the bottom with access to variables instantiated during runtime.

See image below for console im talking about enter image description here

The best thing I could find was a gem called pry, which seems to allow you to access a console during runtime by adding the line 'binding.pry' in your code at the point where you want access to the console. I would be fine with this, but seeing as how rails already gives you access to this when your app crashes, I would think there is a "vanilla" way to do this. Unfortunately I can't find anything online about this feature in rails. This seems like such a valuable tool for debugging I can't see why rails doesn't implement this. Is there a better way to debug during runtime? a better gem?

1 Answer 1

4

I will suggest you to use Better Errors

Better Errors replaces the standard Rails error page with a much better and more useful error page. It is also usable outside of Rails in any Rack app as Rack middleware.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the response, im going to check out this gem. Do you know if there is a way to open the error page while the program is running fine w.o errors, just to access the console?
Thanks, web-console works perfectly for what I want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.