Ticket #10637: remove_example_cleanup_dirs_too.diff
| File remove_example_cleanup_dirs_too.diff, 7.1 kB (added by jamesh, 6 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 … … 61 61 Apache, LiteSpeed, IIS are just a few. For more information on FCGI, 62 62 please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI 63 63 64 65 64 == Debugging Rails 66 65 67 66 Sometimes your application goes wrong. Fortunately there are a lot of tools that … … 87 86 88 87 Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1 89 88 90 More information on how to use the logger is at http://www.ruby-doc.org/core /89 More information on how to use the logger is at http://www.ruby-doc.org/core 91 90 92 Also, Ruby documentation can be found at http://www.ruby-lang.org /including:91 Also, Ruby documentation can be found at http://www.ruby-lang.org including: 93 92 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) 96 95 97 96 These two online (and free) books will bring you up to speed on the Ruby language 98 97 and also on programming in general. 99 98 100 101 99 == Debugger 102 100 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: 101 With debugger, you can break out of execution at any point in the application, examine objects, 102 step through the code, change things like values of variables, and resume execution. To use 103 debugger, 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 105 will 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: 106 107 107 108 class WeblogController < ActionController::Base 108 109 def index … … 111 112 end 112 113 end 113 114 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: 115 So the controller will accept the action, run the first line, then present you with a ruby-debug 116 prompt in the server window. The ruby-debug prompt will allow you to inspect objects, move 117 through the stack and even enter an IRB-like prompt. For more details on how to use ruby-debug, 118 please see ruby-debug's project page http://rubyforge.org/projects/ruby-debug/. 116 119 117 >> @posts.inspect118 => "[#<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.first126 => #<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 133 120 == Console 134 121 135 122 You can interact with the domain model by starting the console through <tt>script/console</tt>. … … 140 127 141 128 To reload your controllers and models after launching the console run <tt>reload!</tt> 142 129 143 144 130 == Description of Contents 145 131 146 app 132 app:: 147 133 Holds all the code that's specific to this particular application. 148 134 149 app/controllers 135 app/controllers:: 150 136 Holds controllers that should be named like weblogs_controller.rb for 151 137 automated URL mapping. All controllers should descend from ApplicationController 152 138 which itself descends from ActionController::Base. 153 139 154 app/models 155 Holds models that should be named like post.rb. 156 Most models will descend from ActiveRecord::Base. 140 app/models:: 141 Holds models that should be named like post.rb. Most models will descend from ActiveRecord::Base. 157 142 158 app/views 143 app/views:: 159 144 Holds the template files for the view that should be named like 160 145 weblogs/index.erb for the WeblogsController#index action. All views use eRuby 161 146 syntax. 162 147 163 app/views/layouts 148 app/views/layouts:: 164 149 Holds the template files for layouts to be used with views. This models the common 165 150 header/footer method of wrapping views. In your views, define a layout using the 166 151 <tt>layout :default</tt> and create a file named default.erb. Inside default.erb, 167 152 call <% yield %> to render the view using this layout. 168 153 169 app/helpers 154 app/helpers:: 170 155 Holds view helpers that should be named like weblogs_helper.rb. These are generated 171 156 for you automatically when using script/generate for controllers. Helpers can be used to 172 157 wrap functionality for your views into methods. 173 158 174 config 159 config:: 175 160 Configuration files for the Rails environment, the routing map, the database, and other dependencies. 176 161 177 db 178 Contains the database schema in schema.rb. db/migrate contains all 179 the sequence ofMigrations for your schema.162 db:: 163 Contains the database schema in schema.rb. db/migrate contains all the sequence of 164 Migrations for your schema. 180 165 181 doc 166 doc:: 182 167 This directory is where your application documentation will be stored when generated 183 168 using <tt>rake doc:app</tt> 184 169 185 lib 170 lib:: 186 171 Application specific libraries. Basically, any kind of custom code that doesn't 187 172 belong under controllers, models, or helpers. This directory is in the load path. 188 173 189 public 174 public:: 190 175 The directory available for the web server. Contains subdirectories for images, stylesheets, 191 176 and javascripts. Also contains the dispatchers and the default HTML files. This should be 192 177 set as the DOCUMENT_ROOT of your web server. 193 178 194 script 179 script:: 195 180 Helper scripts for automation and generation. 196 181 197 test 182 test:: 198 183 Unit and functional tests along with fixtures. When using the script/generate scripts, template 199 184 test files will be generated for you and placed in this directory. 200 185 201 vendor 186 vendor:: 202 187 External libraries that the application depends on. Also includes the plugins subdirectory. 203 188 This directory is in the load path.