Skip to content

Instantly share code, notes, and snippets.

@afmicc
Last active October 20, 2019 02:36
Show Gist options
  • Save afmicc/f5d78deb5e65f17971ebd99a4676e74b to your computer and use it in GitHub Desktop.
Save afmicc/f5d78deb5e65f17971ebd99a4676e74b to your computer and use it in GitHub Desktop.
VS Code debug Ruby on Rails

VS Code debug Ruby on Rails

Steps

  1. In a terminal: run rails debug
  2. In VS Code: Debug > select Listen for rdebug-ide > Play
# lib/tasks/debug.rake
if Rails.env.development?
task :debug do
sh 'bundle exec rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 1234 -- bin/rails s'
end
end
group :development do
gem 'debase'
gem 'ruby-debug-ide'
end
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for rdebug-ide",
"type": "Ruby",
"request": "attach",
"remoteHost": "127.0.0.1",
"remotePort": "1234",
"remoteWorkspaceRoot": "${workspaceRoot}"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment