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

Ticket #7858: README_update.diff

File README_update.diff, 12.6 kB (added by dougal, 1 year ago)
  • railties/README

    old new  
    2121are bundled in a single package due to their heavy interdependence. This is 
    2222unlike the relationship between the Active Record and Action Pack that is much 
    2323more separate. Each of these packages can be used independently outside of 
    24 Rails.  You can read more about Action Pack in 
     24Rails. You can read more about Action Pack in 
    2525link:files/vendor/rails/actionpack/README.html. 
    2626 
    27  
    2827== Getting started 
    2928 
    30291. At the command prompt, start a new rails application using the rails command 
    31    and your application name. Ex: rails myapp 
    32    (If you've downloaded rails in a complete tgz or zip, this step is already done) 
    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!" 
    35 4. Follow the guidelines to start developing your application 
     30and your application name. Ex: <tt>rails myapp</tt> 
     312. Change directory into myapp and start the web server: <tt>script/server</tt> 
     32(run with --help for options) 
     333. Go to http://localhost:3000/ and get the page entitled "Welcome aboard:  
     34You're riding the Rails!" 
     354. Follow the guidelines to start developing your application. 
    3636 
    37  
    3837== Web Servers 
    3938 
    40 By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise 
    41 Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server, 
    42 Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures 
    43 that you can always get up and running quickly. 
     39By default, Rails will try to use Mongrel and lighttpd if they are installed. 
     40Otherwise, Rails will use the WEBrick, the webserver that ships with Ruby. When 
     41you run script/server, Rails will check if Mongrel exists, then lighttpd and 
     42finally fall back to WEBrick. This ensures that you can always get up and 
     43running quickly. 
    4444 
    45 Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is 
    46 suitable for development and deployment of Rails applications. If you have Ruby Gems installed, 
    47 getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>. 
    48 More info at: http://mongrel.rubyforge.org 
     45Mongrel is a Ruby-based webserver with a C-component (which requires 
     46compilation) that is suitable for development and deployment of Rails 
     47applications. If you have Ruby Gems installed, getting up and running with 
     48mongrel is as easy as: <tt>gem install mongrel</tt>. More info at: 
     49http://mongrel.rubyforge.org 
    4950 
    50 If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than 
    51 Mongrel and WEBrick and also suited for production use, but requires additional 
    52 installation and currently only works well on OS X/Unix (Windows users are encouraged 
    53 to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from 
    54 http://www.lighttpd.net. 
     51If Mongrel is not installed, Rails will look for lighttpd. It's considerably 
     52faster than Mongrel and WEBrick and also suited for production use, but 
     53requires additional installation and currently only works well on OS X/Unix 
     54(Windows users are encouraged to start with Mongrel). We recommend using 
     55version 1.4.11 or higher. You can download it from http://www.lighttpd.net. 
    5556 
    56 And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby 
    57 web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not 
    58 for production
     57And finally, if neither Mongrel nor lighttpd are installed, Rails will use the 
     58built-in Ruby web server, WEBrick. WEBrick is a small Ruby web server suitable 
     59for development, but not for production environments
    5960 
    60 But of course its also possible to run Rails on any platform that supports FCGI. 
    61 Apache, LiteSpeed, IIS are just a few. For more information on FCGI, 
    62 please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI 
     61Of course, it's also possible to run Rails on any platform that supports FCGI. 
     62Apache, LiteSpeed, and IIS are just a few of the options. For more information 
     63on FCGI, please visit http://wiki.rubyonrails.com/rails/pages/FastCGI . 
    6364 
    64  
    6565== Debugging Rails 
    6666 
    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. 
     67Have "tail -f" commands running on the server.log and development.log. Rails 
     68will automatically display debugging and runtime information to these files. 
     69Debugging info will also be shown in the browser on requests from 127.0.0.1. 
    7070 
    71  
    7271== Breakpoints 
    7372 
    7473Breakpoint support is available through the script/breakpointer client. This 
    7574means that you can break out of execution at any point in the code, investigate 
    76 and change the model, AND then resume execution! Example: 
     75and change the model, AND then resume execution! For example: 
    7776 
    78   class WeblogController < ActionController::Base 
    79     def index 
    80       @posts = Post.find(:all) 
    81       breakpoint "Breaking out from the list" 
    82     end 
    83   end 
     77 class WeblogController < ActionController::Base 
     78   def index 
     79     @posts = Post.find(:all) 
     80     breakpoint "Breaking out from the list" 
     81   end 
     82 end 
    8483 
    8584So the controller will accept the action, run the first line, then present you 
    86 with a IRB prompt in the breakpointer window. Here you can do things like: 
     85with an IRB prompt in the breakpointer window. Here you can do things like: 
    8786 
    88 Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint' 
     87Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 
     88in 'breakpoint' 
    8989 
    90   >> @posts.inspect 
    91   => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, 
    92        #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" 
    93   >> @posts.first.title = "hello from a breakpoint" 
    94   => "hello from a breakpoint" 
     90 >> @posts.inspect 
     91 => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, 
     92      #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" 
     93 >> @posts.first.title = "hello from a breakpoint" 
     94 => "hello from a breakpoint" 
    9595 
    96 ...and even better is that you can examine how your runtime objects actually work: 
     96...and even better is that you can examine how your runtime objects actually 
     97work: 
    9798 
    98   >> f = @posts.first 
    99   => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> 
    100   >> f. 
    101   Display all 152 possibilities? (y or n) 
     99 >> f = @posts.first 
     100 => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> 
     101 >> f. 
     102 Display all 152 possibilities? (y or n) 
    102103 
    103 Finally, when you're ready to resume execution, you press CTRL-D 
     104Finally, when you're ready to resume execution, you press CTRL-D. 
    104105 
    105106 
    106107== Console 
    107108 
    108 You can interact with the domain model by starting the console through <tt>script/console</tt>. 
    109 Here you'll have all parts of the application configured, just like it is when the 
    110 application is running. You can inspect domain models, change values, and save to the 
    111 database. Starting the script without arguments will launch it in the development environment. 
    112 Passing an argument will specify a different environment, like <tt>script/console production</tt>. 
     109You can interact with the domain model by starting the console through 
     110<tt>script/console</tt>. Here you'll have all parts of the application 
     111configured, just like it is when the application is running. You can inspect 
     112domain models, change values, and save to the database. Starting the script 
     113without arguments will launch it in the development environment. Passing an 
     114argument will specify a different environment: for example, <tt>script/console 
     115production</tt>. 
    113116 
    114 To reload your controllers and models after launching the console run <tt>reload!</tt> 
     117To reload your controllers and models after launching the console run 
     118<tt>reload!</tt> 
    115119 
    116 To reload your controllers and models after launching the console run <tt>reload!</tt> 
    117120 
    118  
    119  
    120121== Description of contents 
    121122 
    122123app 
    123124  Holds all the code that's specific to this particular application. 
    124125 
    125126app/controllers 
    126   Holds controllers that should be named like weblogs_controller.rb for 
    127   automated URL mapping. All controllers should descend from ApplicationController 
    128   which itself descends from ActionController::Base. 
     127  Holds controllers that should be named like weblogs_controller.rb for  
     128  automated URL mapping. All controllers should descend from 
     129  ApplicationController, which itself descends from ActionController::Base. 
    129130 
    130131app/models 
    131   Holds models that should be named like post.rb. 
    132   Most models will descend from ActiveRecord::Base. 
     132  Holds models that should be named like post.rb. Most models will descend from  
     133  ActiveRecord::Base. 
    133134 
    134135app/views 
    135136  Holds the template files for the view that should be named like 
    136   weblogs/index.erb for the WeblogsController#index action. All views use eRuby 
    137   syntax. 
     137  weblogs/index.rhtml for the WeblogsController#index action. All views use 
     138  eRuby syntax. 
    138139 
    139140app/views/layouts 
    140   Holds the template files for layouts to be used with views. This models the common 
    141   header/footer method of wrapping views. In your views, define a layout using the 
    142   <tt>layout :default</tt> and create a file named default.erb. Inside default.erb, 
    143   call <% yield %> to render the view using this layout. 
     141  Holds the template files for layouts to be used with views. This models the  
     142  common header/footer method of wrapping views. In your views, define a layout  
     143  using the <tt>layout :default</tt> and create a file named default.erb.  
     144  Inside default.erb, call <% yield %> to render the view using this layout. 
    144145 
    145146app/helpers 
    146   Holds view helpers that should be named like weblogs_helper.rb. These are generated 
    147   for you automatically when using script/generate for controllers. Helpers can be used to 
    148   wrap functionality for your views into methods. 
     147  Holds view helpers that should be named like weblogs_helper.rb. These are  
     148  generated for you automatically when using script/generate for controllers.  
     149  Helpers can be used to wrap functionality for your views into methods. 
    149150 
    150151config 
    151   Configuration files for the Rails environment, the routing map, the database, and other dependencies. 
     152  Configuration files for the Rails environment, the routing map, the database,  
     153  and other dependencies. 
    152154 
    153155components 
    154   Self-contained mini-applications that can bundle together controllers, models, and views. 
     156  Self-contained mini-applications that can bundle together controllers, 
     157  models, and views. 
    155158 
    156159db 
    157   Contains the database schema in schema.rb.  db/migrate contains all 
    158   the sequence of Migrations for your schema. 
     160  Contains the database schema in schema.rb. db/migrate contains all the 
     161  sequence of Migrations for your schema. 
    159162 
    160163doc 
    161   This directory is where your application documentation will be stored when generated 
    162   using <tt>rake doc:app</tt> 
     164  This directory is where your application documentation will be stored when 
     165  generated using <tt>rake doc:app</tt> 
    163166 
    164167lib 
    165   Application specific libraries. Basically, any kind of custom code that doesn't 
    166   belong under controllers, models, or helpers. This directory is in the load path. 
     168  Application specific libraries: basically, any kind of custom code that 
     169  doesn't belong under controllers, models, or helpers. This directory is in  
     170  the load path. 
    167171 
    168172public 
    169   The directory available for the web server. Contains subdirectories for images, stylesheets, 
    170   and javascripts. Also contains the dispatchers and the default HTML files. This should be 
    171   set as the DOCUMENT_ROOT of your web server. 
     173  The directory available for the web server. Contains subdirectories for 
     174  images, stylesheets, and javascripts. Also contains the dispatchers and the 
     175  default HTML files. This should be set as the DOCUMENT_ROOT of your web  
     176  server. 
    172177 
    173178script 
    174179  Helper scripts for automation and generation. 
    175180 
    176181test 
    177   Unit and functional tests along with fixtures. When using the script/generate scripts, template 
    178   test files will be generated for you and placed in this directory. 
     182  Unit and functional tests along with fixtures. When using the 
     183  script/generate scripts, template test files will be generated for you and 
     184  placed in this directory. 
    179185 
    180186vendor 
    181   External libraries that the application depends on. Also includes the plugins subdirectory. 
    182   This directory is in the load path. 
     187  External libraries that the application depends on. Also includes the 
     188  plugins subdirectory. This directory is in the load path.