简体   繁体   中英

How to enable Trace for a Ruby on Rails application

Is there a capability to enable some type of system trace once in a method in a Ruby on Rails Controller Class? Having real difficulty locating the source code getting executed.

Best thing is to use the ruby debugger.

Assuming you're using Ruby 1.9.3 (please respond if you're not), you imply do the following:

  • In your Gemfile, include the following gem 'debugger'
  • Run bundle after saving
  • In your controller (or wherever you want to use it) place line debugger where you want code execution to stop.

Not hit your app through the browser and look into where you started the server and you should see the debug prompt.

You may have to start your server in debug mode, which you do as follows:

rails server --debugger

For a lot more information on this and other debugging steps, check out the great Rails Guide - Debugging Rails Applications It's a great introduction to debugging rails apps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM