Ticket #10637: reworded_and_include_ruby_debug_homepage.2.diff
| File reworded_and_include_ruby_debug_homepage.2.diff, 3.6 kB (added by jamesh, 8 months ago) |
|---|
-
railties/README
old new 31 31 and your application name. Ex: rails myapp 32 32 (If you've downloaded Rails in a complete tgz or zip, this step is already done) 33 33 2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options) 34 3. Go to http://localhost:3000 /and get "Welcome aboard: Youâre riding the Rails!"34 3. Go to http://localhost:3000 and get "Welcome aboard: Youâre riding the Rails!" 35 35 4. Follow the guidelines to start developing your application 36 36 37 37 38 38 == Web Servers 39 39 40 40 By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise 41 Rails will use WEBrick, the webserver that ships with Ruby. When you run script/server,41 Rails will use WEBrick, the webserver that ships with Ruby. When you run <tt>script/server</tt>, 42 42 Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures 43 43 that you can always get up and running quickly. 44 44 … … 87 87 88 88 Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1 89 89 90 More information on how to use the logger is at http://www.ruby-doc.org/core /90 More information on how to use the logger is at http://www.ruby-doc.org/core 91 91 92 Also, Ruby documentation can be found at http://www.ruby-lang.org /including:92 Also, Ruby documentation can be found at http://www.ruby-lang.org including: 93 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)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 96 97 97 These two online (and free) books will bring you up to speed on the Ruby language 98 98 and also on programming in general. … … 100 100 101 101 == Debugger 102 102 103 Debugger support is available through the debugger command when you start your Mongrel or 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: 103 With debugger, you can break out of execution at any point in the application, examine objects, 104 step through the code, change things like values of variables, and resume execution. To use 105 debugger, you need to install the ruby-debug gem (simply run: <tt>gem install ruby-debug</tt>). Put 106 <tt>debugger</tt> in your code where you want to stop the execution and begin to use debugger. You 107 will also need to start your Mongrel or WEBrick server with --debugger or -u option (E.g. 108 <tt>script/server -u</tt>). Here's an example: 106 109 107 110 class WeblogController < ActionController::Base 108 111 def index … … 111 114 end 112 115 end 113 116 114 So the controller will accept the action, run the first line, then present you 115 with a IRB promptin the server window. Here you can do things like:117 So the controller will accept the action, run the first line, then present you with a IRB prompt 118 in the server window. Here you can do things like: 116 119 117 120 >> @posts.inspect 118 121 => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, … … 127 130 >> f. 128 131 Display all 152 possibilities? (y or n) 129 132 130 Finally, when you're ready to resume execution, you enter "cont"133 Finally, when you're ready to resume normal execution, run ruby-debug's <tt>cont</tt> command. 131 134 135 For more details on how to use ruby-debug, please see its project page: 136 http://rubyforge.org/projects/ruby-debug/ 132 137 133 138 == Console 134 139