Ticket #8770: update_to_debug_section_on_front_readme.diff
| File update_to_debug_section_on_front_readme.diff, 2.2 kB (added by mikel, 1 year ago) |
|---|
-
railties/README
old new 64 64 65 65 == Debugging Rails 66 66 67 Have "tail -f" commands running on the server.log and development.log. Rails will 68 automatically display debugging and runtime information to these files. Debugging 69 info will also be shown in the browser on requests from 127.0.0.1. 67 Sometimes your application goes wrong. Fortunately there are a lot of tools that 68 will help you debug it and get it back on the rails. 70 69 70 First area to check is the application log files. Have "tail -f" commands running 71 on the server.log and development.log. Rails will automatically display debugging 72 and runtime information to these files. Debugging info will also be shown in the 73 browser on requests from 127.0.0.1. 71 74 75 You can also log your own messages directly into the log file from your code using 76 the Ruby logger class from inside your controllers. Example: 77 78 class WeblogController < ActionController::Base 79 def destroy 80 @weblog = Weblog.find(params[:id]) 81 @weblog.destroy 82 logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") 83 end 84 end 85 86 The result will be a message in your log file along the lines of: 87 88 Destroyed Weblog ID #1 89 90 More information on how to use the logger is at http://www.ruby-doc.org/core/ 91 92 Also, Ruby documentation can be found at http://www.ruby-lang.org/ including: 93 94 * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/ 95 * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) 96 97 These two online (and free) books will bring you up to speed on the Ruby language 98 and also on programming in general. 99 100 72 101 == Debugger 73 102 74 103 Debugger support is available through the debugger command when you start your Mongrel or 75 Webrick server with --debugger. This means that you can break out of execution at any point in the code, investigate76 and change the model, AND then resume execution! Example:104 Webrick server with --debugger. This means that you can break out of execution at any point 105 in the code, investigate and change the model, AND then resume execution! Example: 77 106 78 107 class WeblogController < ActionController::Base 79 108 def index