DEV Community

Ankit malik
Ankit malik

Posted on

VsCode Debugger for Ruby on Rails

Steps to Add debugger

  1. Install rdbg extention here.
  2. Create launch.json file in vscode.
  3. Add the given configuration to run the code
  4. [Optional] You can try this command also if this is working then it should run rdbg --open -n -c -- bundle exec rails s

launch.json file for vscode

{
        "version": "0.2.0",
        "configurations": [
                 {
                        "type": "rdbg",
                        "name": "Run rake test",
                        "request": "launch",
                        "command": "rake",
                        "script": "test", 
                        "args": [],
                        "askParameters": false 
                },
                {
                        "type": "rdbg",
                        "name": "Debug Rails server",
                        "request": "launch",
                        "command": "bin/rails",
                        "script": "server", // Launch Rails server with debugger
                        "args": ["-p", "3000"], // Optional: specify port
                        "askParameters": false
                }
        ]
}
Enter fullscreen mode Exit fullscreen mode

Details Reference

https://www.youtube.com/watch?v=e_RKkgiimXE

Top comments (0)