![]() The debugger provides powerful graphical interfaces so developers can step through their program or JavaScript file one line at a time while making full use of all available information in real-time. Automated but safe refactoring helps you improve your project's maintainability by cleaning up your existing source files with quick-fix options. To write code that follows community best practices and ensures the highest quality, use code inspections to identify errors. Using the Smart Search feature, you can quickly jump between classes or symbols in a Rails project with only one click. I have been looking for a way to debug Rails using debug.gem, but I couldn't find it, so I was able to establish a way to do it myself.You can use Ruby on Rails IDE (RubyMine) to increase productivity and improve your code quality by taking advantage of first-class support for languages like CoffeeScript, Sass/Less, ERB, and HAML. I proposed a method of debugging Rails using debug.gem introduced in Ruby 3.1 in a local development environment for Rails projects using Docker (Docker Compose). In fact, we have adjusted the shortcuts for VS code on the Mac to counteract this problem.In the debug console, it's a pain to navigate to variables, panels to execute methods, or to use the mouse to display the terminal.The GUI is intuitive because you can perform Step Over and other functions necessary for debugging, and there are also shortcuts such as F10, which is also convenient.Useful in situations where you want to disable a breakpoint once inside a loop.This is especially useful when starting the Rails server to investigate the cause of a bug. ![]() It allows you to temporarily enable/disable breakpoints, so if you insert a bug line into your code, it will always stop, making it easier to investigate.You can also use Shift+F5 to execute without stopping in the debugger.Ĭompare Pros/Cons of starting Rails server and running Rspec in Terminal Select Debug Rails in Run and Debug to launch Rails and stop it at a breakpoint.ĭisplay the file with the target test code in the forefront of the editor, then select Debug Rspec with current file to run that test code. vscode/launch.json file for use in the debugging part of VS Code in the right panel.Įnter fullscreen mode Exit fullscreen mode (There are still some things that are unclear, such as the fact that bundle exec rails does not work well with the commands in launch.json, but bin/rails does work.įirst, create a. Please note that this is a work-around and there are some unclear points. This section describes settings using debug.gem introduced in Ruby 3.1. Let's develop Rails using Docker with VSCode ~Dev Containers~ The following is a list of the extensions that are required for this project. We have also installed VSCode rdbg Ruby Debugger, which is a necessary extension for this project. ![]() Please refer to the previous Blog for details on environment setup. The sample code for this article can be found at the following URL (vscode tag)ĭetailed version information can be found in the Dockerfile and docker-compose.yml.Ĭreate an appropriate Rails project with the rails new command and create Post and Comment models with scaffold.
0 Comments
Leave a Reply. |