Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10637: remove_example_cleanup_dirs_too.diff

File remove_example_cleanup_dirs_too.diff, 7.1 kB (added by jamesh, 6 months ago)

Removed example debugger usage, opting for blog URL instead. Cleaned up some other cruft at the bottom of the README

  • railties/README

    old new  
    3131   and your application name. Ex: rails myapp 
    3232   (If you've downloaded Rails in a complete tgz or zip, this step is already done) 
    33332. 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!" 
     343. Go to http://localhost:3000 and get "Welcome aboard: You’re riding the Rails!" 
    35354. Follow the guidelines to start developing your application 
    3636 
    3737 
    3838== Web Servers 
    3939 
    4040By 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
     41Rails will use WEBrick, the webserver that ships with Ruby. When you run <tt>script/server</tt>
    4242Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures 
    4343that you can always get up and running quickly. 
    4444 
     
    6161Apache, LiteSpeed, IIS are just a few. For more information on FCGI, 
    6262please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI 
    6363 
    64  
    6564== Debugging Rails 
    6665 
    6766Sometimes your application goes wrong.  Fortunately there are a lot of tools that 
     
    8786 
    8887  Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1 
    8988 
    90 More information on how to use the logger is at http://www.ruby-doc.org/core/ 
     89More information on how to use the logger is at http://www.ruby-doc.org/core 
    9190 
    92 Also, Ruby documentation can be found at http://www.ruby-lang.org/ including: 
     91Also, Ruby documentation can be found at http://www.ruby-lang.org including: 
    9392 
    94 * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/ 
    95 * Learn to Program: http://pine.fm/LearnToProgram/  (a beginners guide) 
     93* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby 
     94* Learn to Program: http://pine.fm/LearnToProgram  (a beginners guide) 
    9695 
    9796These two online (and free) books will bring you up to speed on the Ruby language 
    9897and also on programming in general. 
    9998 
    100  
    10199== Debugger 
    102100 
    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: 
     101With debugger, you can break out of execution at any point in the application, examine objects, 
     102step through the code, change things like values of variables, and resume execution. To use  
     103debugger, you need to install the ruby-debug gem (simply run: <tt>gem install ruby-debug</tt>). Put  
     104<tt>debugger</tt> in your code where you want to stop the execution and begin to use debugger. You  
     105will also need to start your Mongrel or WEBrick server with --debugger or -u option (E.g.  
     106<tt>script/server -u</tt>). Here's an example: 
    106107 
    107108  class WeblogController < ActionController::Base 
    108109    def index 
     
    111112    end 
    112113  end 
    113114 
    114 So the controller will accept the action, run the first line, then present you 
    115 with a IRB prompt in the server window. Here you can do things like: 
     115So the controller will accept the action, run the first line, then present you with a ruby-debug  
     116prompt in the server window. The ruby-debug prompt will allow you to inspect objects, move  
     117through the stack and even enter an IRB-like prompt. For more details on how to use ruby-debug,  
     118please see ruby-debug's project page http://rubyforge.org/projects/ruby-debug/. 
    116119 
    117   >> @posts.inspect 
    118   => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, 
    119        #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" 
    120   >> @posts.first.title = "hello from a debugger" 
    121   => "hello from a debugger" 
    122  
    123 ...and even better is that you can examine how your runtime objects actually work: 
    124  
    125   >> f = @posts.first 
    126   => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> 
    127   >> f. 
    128   Display all 152 possibilities? (y or n) 
    129  
    130 Finally, when you're ready to resume execution, you enter "cont" 
    131  
    132  
    133120== Console 
    134121 
    135122You can interact with the domain model by starting the console through <tt>script/console</tt>. 
     
    140127 
    141128To reload your controllers and models after launching the console run <tt>reload!</tt> 
    142129 
    143  
    144130== Description of Contents 
    145131 
    146 app 
     132app:: 
    147133  Holds all the code that's specific to this particular application. 
    148134 
    149 app/controllers 
     135app/controllers:: 
    150136  Holds controllers that should be named like weblogs_controller.rb for 
    151137  automated URL mapping. All controllers should descend from ApplicationController 
    152138  which itself descends from ActionController::Base. 
    153139 
    154 app/models 
    155   Holds models that should be named like post.rb. 
    156   Most models will descend from ActiveRecord::Base. 
     140app/models:: 
     141  Holds models that should be named like post.rb. Most models will descend from ActiveRecord::Base. 
    157142 
    158 app/views 
     143app/views:: 
    159144  Holds the template files for the view that should be named like 
    160145  weblogs/index.erb for the WeblogsController#index action. All views use eRuby 
    161146  syntax. 
    162147 
    163 app/views/layouts 
     148app/views/layouts:: 
    164149  Holds the template files for layouts to be used with views. This models the common 
    165150  header/footer method of wrapping views. In your views, define a layout using the 
    166151  <tt>layout :default</tt> and create a file named default.erb. Inside default.erb, 
    167152  call <% yield %> to render the view using this layout. 
    168153 
    169 app/helpers 
     154app/helpers:: 
    170155  Holds view helpers that should be named like weblogs_helper.rb. These are generated 
    171156  for you automatically when using script/generate for controllers. Helpers can be used to 
    172157  wrap functionality for your views into methods. 
    173158 
    174 config 
     159config:: 
    175160  Configuration files for the Rails environment, the routing map, the database, and other dependencies. 
    176161 
    177 db 
    178   Contains the database schema in schema.rb.  db/migrate contains all 
    179   the sequence of Migrations for your schema. 
     162db:: 
     163  Contains the database schema in schema.rb.  db/migrate contains all the sequence of  
     164  Migrations for your schema. 
    180165 
    181 doc 
     166doc:: 
    182167  This directory is where your application documentation will be stored when generated 
    183168  using <tt>rake doc:app</tt> 
    184169 
    185 lib 
     170lib:: 
    186171  Application specific libraries. Basically, any kind of custom code that doesn't 
    187172  belong under controllers, models, or helpers. This directory is in the load path. 
    188173 
    189 public 
     174public:: 
    190175  The directory available for the web server. Contains subdirectories for images, stylesheets, 
    191176  and javascripts. Also contains the dispatchers and the default HTML files. This should be 
    192177  set as the DOCUMENT_ROOT of your web server. 
    193178 
    194 script 
     179script:: 
    195180  Helper scripts for automation and generation. 
    196181 
    197 test 
     182test:: 
    198183  Unit and functional tests along with fixtures. When using the script/generate scripts, template 
    199184  test files will be generated for you and placed in this directory. 
    200185 
    201 vendor 
     186vendor:: 
    202187  External libraries that the application depends on. Also includes the plugins subdirectory. 
    203188  This directory is in the load path.