Edw*_*ndo 21 ruby ruby-on-rails byebug
我想使用byebug来调试我的应用程序,但应用程序永远不会停止,尽管我已经放入byebug我的代码中.这是我的Gemfile.
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', '~> 5.0.0'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
Run Code Online (Sandbox Code Playgroud)
我放入byebug了我的一个控制器.
def edit
byebug
present Ingredient::Update
end
Run Code Online (Sandbox Code Playgroud)
我已经在我的所有地方提出了我的要求development.rb.我已经重启服务器几次了.
config.consider_all_requests_local = true
Run Code Online (Sandbox Code Playgroud)
下面是示例堆栈跟踪,byebug仅打印第一个跟踪,然后应用程序继续执行下一行.
web_1 | [43, 52] in /recipe/app/controllers/ingredients_controller.rb
web_1 | 43: def update
web_1 | 44: run Ingredient::Update do |op|
web_1 | 45: return redirect_to op.model
web_1 | 46: end
web_1 | 47: byebug
web_1 | => 48: render action: :edit
web_1 | 49: end
web_1 | 50:
web_1 | 51: # DELETE /ingredients/1
web_1 | 52: # DELETE /ingredients/1.json
web_1 | (byebug) Rendered ingredients/edit.haml within layouts/application (264.1ms)
web_1 | Rendered layouts/_navigation.haml (45.0ms)
web_1 | Completed 200 OK in 2827ms (Views: 2764.0ms | ActiveRecord: 3.9ms)
web_1 |
web_1 |
web_1 | Started GET "/assets/application.self-1ca8529ef221ef9dba25e835f258c4e62f2f49bce400273a67e63d7d73be28ba.css?body=1" for 192.168.59.3 at 2015-07-28 06:46:00 +0000
Run Code Online (Sandbox Code Playgroud)
任何的想法? 更新 我在我的Rails应用程序中使用docker-compose和docker.
pge*_*son 75
当docker-compose与byebug此结合使用时,需要添加它以使其正常工作.在这篇博文中找到
将其添加到docker-compose.yml
web:
...
stdin_open: true
tty: true
Run Code Online (Sandbox Code Playgroud)
然后在deamonized模式下运行docker-compose并使用docker连接到web容器:
docker-compose up -d
docker attach myappname_web_1
Run Code Online (Sandbox Code Playgroud)
小智 5
要启用调试器模式:
docker-compose run --service-ports web
Run Code Online (Sandbox Code Playgroud)
看到这篇博客文章
| 归档时间: |
|
| 查看次数: |
7513 次 |
| 最近记录: |