rails 1.1.6 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (104) hide show
  1. data/CHANGELOG +267 -2
  2. data/MIT-LICENSE +1 -1
  3. data/README +62 -63
  4. data/Rakefile +26 -15
  5. data/bin/process/inspector +3 -0
  6. data/configs/databases/frontbase.yml +28 -0
  7. data/configs/databases/mysql.yml +3 -2
  8. data/configs/databases/oracle.yml +10 -1
  9. data/configs/databases/sqlite3.yml +3 -0
  10. data/configs/lighttpd.conf +1 -0
  11. data/configs/routes.rb +1 -0
  12. data/environments/boot.rb +4 -3
  13. data/environments/environment.rb +9 -2
  14. data/environments/production.rb +1 -1
  15. data/helpers/application.rb +5 -2
  16. data/html/404.html +27 -5
  17. data/html/500.html +27 -5
  18. data/html/javascripts/controls.js +41 -23
  19. data/html/javascripts/dragdrop.js +105 -76
  20. data/html/javascripts/effects.js +293 -163
  21. data/html/javascripts/prototype.js +897 -389
  22. data/lib/breakpoint.rb +31 -1
  23. data/lib/breakpoint_client.rb +5 -5
  24. data/lib/code_statistics.rb +1 -1
  25. data/lib/commands/performance/profiler.rb +25 -9
  26. data/lib/commands/plugin.rb +69 -23
  27. data/lib/commands/process/inspector.rb +68 -0
  28. data/lib/commands/process/reaper.rb +88 -69
  29. data/lib/commands/process/spawner.rb +148 -33
  30. data/lib/commands/runner.rb +27 -6
  31. data/lib/commands/server.rb +18 -9
  32. data/lib/commands/servers/base.rb +19 -0
  33. data/lib/commands/servers/lighttpd.rb +20 -18
  34. data/lib/commands/servers/mongrel.rb +65 -0
  35. data/lib/console_sandbox.rb +2 -2
  36. data/lib/dispatcher.rb +67 -11
  37. data/lib/fcgi_handler.rb +52 -34
  38. data/lib/initializer.rb +190 -111
  39. data/lib/rails/version.rb +2 -2
  40. data/lib/rails_generator/base.rb +82 -24
  41. data/lib/rails_generator/commands.rb +87 -25
  42. data/lib/rails_generator/generated_attribute.rb +42 -0
  43. data/lib/rails_generator/generators/applications/app/app_generator.rb +13 -10
  44. data/lib/rails_generator/generators/components/controller/controller_generator.rb +1 -2
  45. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +10 -8
  46. data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +1 -1
  47. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +4 -4
  48. data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +1 -1
  49. data/lib/rails_generator/generators/components/migration/templates/migration.rb +1 -1
  50. data/lib/rails_generator/generators/components/model/USAGE +19 -12
  51. data/lib/rails_generator/generators/components/model/model_generator.rb +4 -0
  52. data/lib/rails_generator/generators/components/model/templates/fixtures.yml +8 -2
  53. data/lib/rails_generator/generators/components/model/templates/migration.rb +3 -1
  54. data/lib/rails_generator/generators/components/observer/USAGE +15 -0
  55. data/lib/rails_generator/generators/components/observer/observer_generator.rb +16 -0
  56. data/lib/rails_generator/generators/components/observer/templates/observer.rb +2 -0
  57. data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +10 -0
  58. data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +4 -0
  59. data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +1 -0
  60. data/lib/rails_generator/generators/components/resource/resource_generator.rb +76 -0
  61. data/lib/rails_generator/generators/components/resource/templates/USAGE +18 -0
  62. data/lib/rails_generator/generators/components/resource/templates/controller.rb +2 -0
  63. data/lib/rails_generator/generators/components/resource/templates/fixtures.yml +11 -0
  64. data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +20 -0
  65. data/lib/rails_generator/generators/components/resource/templates/helper.rb +2 -0
  66. data/lib/rails_generator/generators/components/resource/templates/migration.rb +13 -0
  67. data/lib/rails_generator/generators/components/resource/templates/model.rb +2 -0
  68. data/lib/rails_generator/generators/components/resource/templates/unit_test.rb +10 -0
  69. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +10 -1
  70. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +11 -7
  71. data/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +5 -1
  72. data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +2 -2
  73. data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +1 -1
  74. data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +2 -2
  75. data/lib/rails_generator/generators/components/scaffold_resource/USAGE +29 -0
  76. data/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +92 -0
  77. data/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb +79 -0
  78. data/lib/rails_generator/generators/components/scaffold_resource/templates/fixtures.yml +11 -0
  79. data/lib/rails_generator/generators/components/scaffold_resource/templates/functional_test.rb +57 -0
  80. data/lib/rails_generator/generators/components/scaffold_resource/templates/helper.rb +2 -0
  81. data/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml +17 -0
  82. data/lib/rails_generator/generators/components/scaffold_resource/templates/migration.rb +13 -0
  83. data/lib/rails_generator/generators/components/scaffold_resource/templates/model.rb +2 -0
  84. data/lib/rails_generator/generators/components/scaffold_resource/templates/style.css +74 -0
  85. data/lib/rails_generator/generators/components/scaffold_resource/templates/unit_test.rb +10 -0
  86. data/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml +19 -0
  87. data/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml +24 -0
  88. data/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml +18 -0
  89. data/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml +10 -0
  90. data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +7 -1
  91. data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +5 -4
  92. data/lib/rails_generator/lookup.rb +1 -2
  93. data/lib/rails_generator/options.rb +6 -3
  94. data/lib/tasks/databases.rake +46 -20
  95. data/lib/tasks/documentation.rake +1 -0
  96. data/lib/tasks/framework.rake +1 -3
  97. data/lib/tasks/pre_namespace_aliases.rake +34 -27
  98. data/lib/tasks/rails.rb +2 -2
  99. data/lib/tasks/statistics.rake +6 -5
  100. data/lib/tasks/testing.rake +28 -13
  101. data/lib/tasks/tmp.rake +8 -1
  102. data/lib/test_help.rb +3 -2
  103. data/lib/webrick_server.rb +6 -8
  104. metadata +50 -9
data/CHANGELOG CHANGED
@@ -1,3 +1,265 @@
1
+ *1.2.0* (January 16th, 2007)
2
+
3
+ * Update to Prototype 1.5.0. [Sam Stephenson]
4
+
5
+ * Generator: use destination path for diff tempfiles. #7015 [alfeld]
6
+
7
+ * Fixed that webrick would strip leading newlines and hang connection #4156 [psross]
8
+
9
+ * Ensure plugins are in the Dependencies.load_once_paths collection by default. [Rick]
10
+ If you really want your plugins to reload, add this to the very top of init.rb:
11
+
12
+ Dependencies.load_once_paths.delete(lib_path)
13
+
14
+ * Fix scaffold_resource generator so it respects the --pretend argument when creating the routes file. Closes #6852 [fearoffish]
15
+
16
+ * Fix Webrick Daemon dispatching bug regarding a bad current working directory. Closes #4899 [Rick Olson]
17
+
18
+ * Make config.plugins affect the load path and the dependencies system. Allows you to control plugin loading order, and keep disabled plugins off the load path. [James Adam]
19
+
20
+ * Don't generate a components directory in new Rails apps. [Jeremy Kemper]
21
+
22
+ * Fixed script/process/spawner to work properly with Mongrel including in -r (daemonize mode) [DHH]
23
+
24
+ * Deprecated the name route "root" as it'll be used as a shortcut for map.connect '' in Rails 2.0 [DHH]
25
+
26
+ * Fixed that script/server running against Mongrel should tail the proper log regardless of the environment [DHH]
27
+
28
+ * Update initializer to load Rails::VERSION as soon as possible. Closes #6698. [Nicholas Seckar]
29
+
30
+ * Added ActiveRecord::Base.clear_active_connections! in development mode so the database connection is not carried over from request to request. Some databases won't reread the schema if that doesn't happen (I'm looking at you SQLite), so you have to restart the server after each migration (= no fun) [DHH]
31
+
32
+ * Made RAILS_GEM_VERSION work for beta gems too, so specifying 1.1.6 will give you 1.1.6.4520 if available [DHH]
33
+
34
+ * Update to Prototype and script.aculo.us [5579]. [Sam Stephenson, Thomas Fuchs]
35
+
36
+ * Made script/server work with -e and -d when using Mongrel [DHH]
37
+
38
+ * Make sure that exceptions which are thrown outside of the user code try their best to be handeled in ApplicationController#rescue_action [Tobias Luetke]
39
+
40
+ * Rails::VERSION::STRING should always be available without having to require 'rails/version'. #6244 [fearoffish]
41
+
42
+ * Add grep-based fallback to reaper, to work in pidless setups [Jamis Buck]
43
+
44
+ * Only wrap request processing with our USR1 signal handler so FastCGI can trap it and raise an exception while waiting for connections. Idle processes exit immediately rather than waiting for another request; active processes gracefully exit when the request is finished. [Jeremy Kemper]
45
+
46
+ * Alter prior change to use require_dependency instead of require_or_load. Causes ApplicationController to be reloaded again. Closes #6587. [Nicholas Seckar]
47
+
48
+ * Rake: use absolute paths to load lib and vendor tasks so they may be run outside of RAILS_ROOT. #6584 [jchris]
49
+
50
+ * scaffold_resource generator uses _path named routes and head instead of render :nothing => true. #6545 [Josh Susser]
51
+
52
+ * Generator can show diff on file collision to help you decide whether to skip or overwrite. #6364 [jeffw, Jeremy Kemper]
53
+
54
+ * Generated directories are recursively svn added, like mkdir -p. #6416 [NeilW]
55
+
56
+ * resource and scaffold_resource generators add a restful route to config/routes.rb [Jeremy Kemper]
57
+
58
+ * Revert environment changes for autoload_paths. [Koz]
59
+
60
+ * Clean up the output of rake stats, de-emphasise components and apis, and remove the indents for tests [Koz]
61
+
62
+ * Added option to script/process/spawner of specifying the binding address #5133 [zsombor]
63
+
64
+ * Update environment.rb comments to include config.autoload_paths. Closes #6478 [caio]
65
+
66
+ * Update scaffold to use new form_tag block functionality. Closes #6480. [BobSilva]
67
+
68
+ * Plugin generator: check for class collisions. #4833 [vinbarnes@gmail.com]
69
+
70
+ * Mailer generator: handle mailers in modules, set mime_version in unit test. [Jeremy Kemper]
71
+
72
+ * Set $KCODE to 'u' by default to enable the multibyte safe String#chars proxy. [Koz]
73
+
74
+ * Added config.plugins to control which plugins are loaded #6269 [skaes]. By default, everything in vendor/plugins will be loaded, but if you specify config.plugins, only those will be loaded. Example:
75
+
76
+ config.plugins = %w[ routing_navigator simply_helpful ]
77
+
78
+ * Clean up html on included error pages. [Tim Lucas]
79
+
80
+ * Fixed default 404.html and 500.htmls to remove extreme ugliness and include human language [DHH]
81
+
82
+ * Update to latest Prototype and script.aculo.us trunk versions [Thomas Fuchs]
83
+
84
+ * PostgreSQL: db:test:purge closes open database connections first. #6236 [alex]
85
+
86
+ * Fixed test:uncommitted on Windows (backslash issue) #4999 [paul@paulbutcher.com]
87
+
88
+ * Fixed migration creation to work with namespaced models, so script/generate model Gallery::Image will use create_table :gallery_images #6327 [BobSilva]
89
+
90
+ * Fixed rename_table on SQLite tables with indexes defined #5942 [brandon@opensoul.org]
91
+
92
+ * Added default timeout setting of 5 seconds to SQLite3 database.yml configurations [DHH]
93
+
94
+ * Added generated attribute options to script/generate model, like the one found in scaffold_resource and resource [DHH]. Examples:
95
+
96
+ ./script/generate model post title:string created_on:date body:text published:boolean
97
+
98
+ * Added script/generate resource which works just like scaffold_resource, but creates empty placeholders instead of predefined [DHH]
99
+
100
+ * script/runner can run files, pass on arguments, and be used as a shebang. #6286 [Tuxie, dlpond]
101
+ #!/usr/bin/env /path/to/my/app/script/runner
102
+ # Example: just start using your models as if you are in script/console
103
+ Product.find(:all).each { |product| product.check_inventory }
104
+
105
+ * Look for rake tasks in plugin subdirs. #6259 [obrie]
106
+
107
+ * Added map.connect ':controller/:action/:id.:format' as a default route to config/routes.rb [DHH]
108
+
109
+ * session_migration generator adds an index on updated_at. #6207 [grg]
110
+
111
+ * script/server creates the tmp/pids directory. #6204 [jonathan]
112
+
113
+ * Fix script/console --sandbox for internal transactions changes. #5738 [chris@octopod.info, charles.gerungan@gmail.com]
114
+
115
+ * Remove the uncanny default of adding all app/models/*/ directories to the load path. This change will break application which expect the current behavior. As
116
+ documented in initializer.rb, the workaround is:
117
+
118
+ config.autoload_paths += Dir[RAILS_ROOT + '/app/models/*/']
119
+
120
+ References #6031. [Nicholas Seckar]
121
+
122
+ * Update to script.aculo.us 1.6.3 [Thomas Fuchs]
123
+
124
+ * Formally Deprecate the old rake tasks. [Koz]
125
+
126
+ * Thoroughly test the FCGI dispatcher. #5970 [Kevin Clark]
127
+
128
+ * Remove Dir.chdir in the Webrick DispatchServlet#initialize method. Fix bad path errors when trying to load config/routes.rb. [Rick Olson]
129
+
130
+ * Tighten rescue clauses. #5985 [james@grayproductions.net]
131
+
132
+ * Cleaning up tests. [Kevin Clark, Jeremy Kemper]
133
+
134
+ * Add Dependencies.load_once_paths. [Nicholas Seckar]
135
+
136
+ * Assign Routing.controller_paths; fix script/about and rails info controller. [Nicholas Seckar]
137
+
138
+ * Don't warn dispatcher of Reloadable deprecations. [Nicholas Seckar]
139
+
140
+ * Rearrange application resetting and preparation, fix bug with leaking subclasses hash in ActiveRecord::Base [Rick Olson]
141
+
142
+ ActiveRecord::Base.reset_subclasses is called before Dependencies are cleared and classes removed.
143
+ ActiveRecord::Base.instantiate_observers is called during a Dispatcher preparation callback.
144
+
145
+ * Add missing mock directories from the autoload_paths configuration. [Rick Olson]
146
+
147
+ * Nested controller scaffolding also nests the generated layout. [iain d broadfoot]
148
+
149
+ * Add "require 'dispatcher'" to webrick server in the continuing quest to squash webrick weirdness. [Nicholas Seckar]
150
+
151
+ * Add autoload_paths support to Initializer. [Nicholas Seckar]
152
+
153
+ * Fix Dispatcher.reset_application! so that AR subclasses are removed and Observers re-initialized *after* Reloadable classes are removed. Closes #5743. [Rick Olson]
154
+
155
+ * Clarify usage of script/plugin source. Closes #5344. [james.adam@gmail.com]
156
+
157
+ * Add Dispatcher.to_prepare and config.to_prepare to provide a pre-request hook. [Nicholas Seckar]
158
+
159
+ * Tweak the Rails load order so observers are loaded after plugins, and reloaded in development mode. Closed #5279. [Rick Olson]
160
+
161
+ * Added that you can change the web server port in config/lighttpd.conf from script/server --port/-p #5465 [mats@imediatec.co.uk]
162
+
163
+ * script/performance/profiler compatibility with the new ruby-prof, including an option to choose the results printer. #5679 [shugo@ruby-lang.org]
164
+
165
+ * Fixed the failsafe response so it uses either the current recognized controller or ApplicationController. [Rick Olson]
166
+
167
+ * Make sure script/reaper only reaps dispatcher pids by default, and not the spawner's pid. [Jamis Buck]
168
+
169
+ * Fix script/plugin about so it uses about.yml and not meta.yml. [James Adam]
170
+
171
+ * Dispatcher processes rescued actions with the same controller that processed the request. #4625 [sd@notso.net]
172
+
173
+ * rails -d frontbase to create a new project with a frontbase database.yml. #4945 [mlaster@metavillage.com]
174
+
175
+ * Ensure the logger is initialized. #5629 [mike@clarkware.com]
176
+
177
+ * Added Mongrel-spawning capabilities to script/process/spawner. Mongrel will be the default choice if installed, otherwise FCGI is tried [DHH]. Examples:
178
+
179
+ spawner # starts instances on 8000, 8001, and 8002 using Mongrel if available
180
+ spawner fcgi # starts instances on 8000, 8001, and 8002 using FCGI
181
+ spawner mongrel -i 5 # starts instances on 8000, 8001, 8002, 8003, and 8004 using Mongrel
182
+ spawner -p 9100 -i 10 # starts 10 instances counting from 9100 to 9109 using Mongrel if available
183
+ spawner -p 9100 -r 5 # starts 3 instances counting from 9100 to 9102 and attempts start them every 5 seconds
184
+
185
+ Also note that script/process/reaper is Mongrel capable. So the combination of spawner and reaper is a built-in alternative to something like mongrel_cluster.
186
+
187
+ * Update scaffolding functional tests to use :id => people(:first) instead of :id => 1. #5612 [evan@protest.net]
188
+
189
+ * db:test:clone should remove existing tables before reloading the schema. #5607 [sveit@tradeharbor.com]
190
+
191
+ * Fixed migration generation for class names like ACLController #5197 [brad@madriska.com]
192
+
193
+ * Added show_source_list and show_call_stack to breakpoints to make it easier to get context #5476 [takiuchi@drecom.co.jp]. Examples:
194
+
195
+ irb(#<TopController:0x40822a68>):002:0> show_source_list
196
+ 0001 class TopController < ApplicationController
197
+ 0002 def show
198
+ 0003-> breakpoint
199
+ 0004 end
200
+ 0005
201
+ 0006 def index
202
+ 0007 end
203
+ 0008
204
+ => "/path/to/rails/root/app/controllers/top_controller.rb"
205
+
206
+ irb(#<TopController:0x40822a68>):004:0> show_call_stack 3
207
+ vendor/rails/railties/lib/breakpoint.rb:536:in `breakpoint'
208
+ vendor/rails/railties/lib/breakpoint.rb:536:in `breakpoint'
209
+ app/controllers/top_controller.rb:3:in `show'
210
+ => "/path/to/rails/root/app/controllers/top_controller.rb:3"
211
+
212
+ * Generate scaffold layout in subdirectory appropriate to its module nesting. #5511 [nils@alumni.rice.edu]
213
+
214
+ * Mongrel: script/server tails the rails log like it does with lighttpd. Prefer mongrel over lighttpd. #5541 [mike@clarkware.com]
215
+
216
+ * Don't assume Active Record is available. #5497 [bob@sporkmonger.com]
217
+
218
+ * Mongrel: script/server works on Win32. #5499 [jeremydurham@gmail.com]
219
+
220
+ * Remove opts.on { |options[:option_name] } style hash assignment. Closes #4440. [nicksieger@gmail.com]
221
+
222
+ * Mongrel support for script/server. #5475 [jeremydurham@gmail.com]
223
+
224
+ * Fix script/plugin so it doesn't barf on invalid URLs [Rick]
225
+
226
+ * Fix plugin install bug at dir with space. (closes #5359) [Yoshimasa NIWA]
227
+
228
+ * Fix bug with 'script/plugin install' so it reports unknown plugin names correctly. [Rick]
229
+
230
+ * Added uninstall.rb hook to plugin handling, such that plugins have a way of removing assets and other artifacts on removal #5003 [takiuchi@drecom.co.jp]
231
+
232
+ * Create temporary dirs relative to RAILS_ROOT when running script/server #5014 [elliot@townx.org]
233
+
234
+ * Minor tweak to dispatcher to use recognize instead of recognize!, as per the new routes. [Jamis Buck]
235
+
236
+ * Make "script/plugin install" work with svn+ssh URLs. [Sam Stephenson]
237
+
238
+ * Added lib/ to the directories that will get application docs generated [DHH]
239
+
240
+ * Add observer generator. Closes #5167. [francois.beausoleil@gmail.com]
241
+
242
+ * Session migration generator obeys pluralize_table_names. #5145 [james.adam@gmail.com]
243
+
244
+ * rake test:recent understands subdirectories. #2925 [jerrett@bravenet.com]
245
+
246
+ * The app generator detects the XAMPP package's MySQL socket location. #3832 [elliot@townx.org]
247
+
248
+ * The app generator sets a session key in application.rb so apps running on the same host may distinguish their cookies. #2967 [rcoder, rails-bug@owl.me.uk]
249
+
250
+ * Distinguish the spawners for different processes [DHH]
251
+
252
+ * Added -n/--process to script/process/spawner name the process pid (default is dispatch) [DHH]
253
+
254
+ * Namespaced OrderedHash so the Rails implementation does not clash with any others. (fixes #4911) [Julian Tarkhanov]
255
+
256
+ * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
257
+
258
+ * Added script/process/inspector to do simple process status information on Rails dispatchers keeping pid files in tmp/pids [DHH]
259
+
260
+ * Added pid file usage to script/process/spawner and script/process/reaper along with a directive in default config/lighttpd.conf file to record the pid. They will all save their pid file in tmp/pids [DHH]
261
+
262
+
1
263
  *1.1.6* (August 10th, 2006)
2
264
 
3
265
  * Additional security patch
@@ -24,7 +286,11 @@
24
286
  * Updated to Active Record 1.14.3, Action Pack 1.12.2, ActionWebService 1.1.3, ActionMailer 1.2.2
25
287
 
26
288
 
27
- *1.1.2* (April 9th, 2006)
289
+ *1.1.2* (April 9th, 2005)
290
+
291
+ * Mention in docs that config.frameworks doesn't work when getting Rails via Gems. Closes #4857. [Alisdair McDiarmid]
292
+
293
+ * Change the scaffolding layout to use yield rather than @content_for_layout. [Marcel Molina Jr.]
28
294
 
29
295
  * Added rake rails:update:configs to update config/boot.rb from the latest (also included in rake rails:update) [DHH]
30
296
 
@@ -211,7 +477,6 @@
211
477
 
212
478
  * Honor ActiveRecord::Base.pluralize_table_names when creating and destroying session store table. #3204. [rails@bencurtis.com, Marcel Molina Jr.]
213
479
 
214
-
215
480
  *1.0.0* (December 13th, 2005)
216
481
 
217
482
  * Update instructions on how to find and install generators. #3172. [Chad Fowler]
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004 David Heinemeier Hansson
1
+ Copyright (c) 2004-2006 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README CHANGED
@@ -13,7 +13,7 @@ Product, Show Post) by manipulating the model and directing data to the view.
13
13
  In Rails, the model is handled by what's called an object-relational mapping
14
14
  layer entitled Active Record. This layer allows you to present the data from
15
15
  database rows as objects and embellish these data objects with business logic
16
- methods. You can read more about Active Record in
16
+ methods. You can read more about Active Record in
17
17
  link:files/vendor/rails/activerecord/README.html.
18
18
 
19
19
  The controller and view are handled by the Action Pack, which handles both
@@ -21,65 +21,52 @@ layers by its two parts: Action View and Action Controller. These two layers
21
21
  are bundled in a single package due to their heavy interdependence. This is
22
22
  unlike the relationship between the Active Record and Action Pack that is much
23
23
  more separate. Each of these packages can be used independently outside of
24
- Rails. You can read more about Action Pack in
24
+ Rails. You can read more about Action Pack in
25
25
  link:files/vendor/rails/actionpack/README.html.
26
26
 
27
27
 
28
28
  == Getting started
29
29
 
30
- 1. Start the web server: <tt>ruby script/server</tt> (run with --help for options)
31
- 2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
32
- 3. Follow the guidelines to start developing your application
30
+ 1. 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
33
36
 
34
37
 
35
- == Web servers
38
+ == Web Servers
36
39
 
37
- Rails uses the built-in web server in Ruby called WEBrick by default, so you don't
38
- have to install or configure anything to play around.
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.
39
44
 
40
- If you have lighttpd installed, though, it'll be used instead when running script/server.
41
- It's considerably faster than WEBrick and suited for production use, but requires additional
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
49
+
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
42
52
  installation and currently only works well on OS X/Unix (Windows users are encouraged
43
- to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from
53
+ to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
44
54
  http://www.lighttpd.net.
45
55
 
46
- If you want something that's halfway between WEBrick and lighttpd, we heartily recommend
47
- Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that
48
- also works very well with Windows. See more at http://mongrel.rubyforge.org/.
49
-
50
- But of course its also possible to run Rails with the premiere open source web server Apache.
51
- To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want
52
- to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid.
53
-
54
- See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI.
55
-
56
- == Example for Apache conf
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.
57
59
 
58
- <VirtualHost *:80>
59
- ServerName rails
60
- DocumentRoot /path/application/public/
61
- ErrorLog /path/application/log/server.log
62
-
63
- <Directory /path/application/public/>
64
- Options ExecCGI FollowSymLinks
65
- AllowOverride all
66
- Allow from all
67
- Order allow,deny
68
- </Directory>
69
- </VirtualHost>
70
-
71
- NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
72
- should be on and ".cgi" should respond. All requests from 127.0.0.1 go
73
- through CGI, so no Apache restart is necessary for changes. All other requests
74
- go through FCGI (or mod_ruby), which requires a restart to show changes.
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
75
63
 
76
64
 
77
65
  == Debugging Rails
78
66
 
79
- Have "tail -f" commands running on both the server.log, production.log, and
80
- test.log files. Rails will automatically display debugging and runtime
81
- information to these files. Debugging info will also be shown in the browser
82
- on requests from 127.0.0.1.
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.
83
70
 
84
71
 
85
72
  == Breakpoints
@@ -90,25 +77,25 @@ and change the model, AND then resume execution! Example:
90
77
 
91
78
  class WeblogController < ActionController::Base
92
79
  def index
93
- @posts = Post.find_all
80
+ @posts = Post.find(:all)
94
81
  breakpoint "Breaking out from the list"
95
82
  end
96
83
  end
97
-
84
+
98
85
  So the controller will accept the action, run the first line, then present you
99
86
  with a IRB prompt in the breakpointer window. Here you can do things like:
100
87
 
101
88
  Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
102
89
 
103
90
  >> @posts.inspect
104
- => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
91
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
105
92
  #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
106
93
  >> @posts.first.title = "hello from a breakpoint"
107
94
  => "hello from a breakpoint"
108
95
 
109
96
  ...and even better is that you can examine how your runtime objects actually work:
110
97
 
111
- >> f = @posts.first
98
+ >> f = @posts.first
112
99
  => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
113
100
  >> f.
114
101
  Display all 152 possibilities? (y or n)
@@ -118,7 +105,7 @@ Finally, when you're ready to resume execution, you press CTRL-D
118
105
 
119
106
  == Console
120
107
 
121
- You can interact with the domain model by starting the console through script/console.
108
+ You can interact with the domain model by starting the console through <tt>script/console</tt>.
122
109
  Here you'll have all parts of the application configured, just like it is when the
123
110
  application is running. You can inspect domain models, change values, and save to the
124
111
  database. Starting the script without arguments will launch it in the development environment.
@@ -126,6 +113,8 @@ Passing an argument will specify a different environment, like <tt>script/consol
126
113
 
127
114
  To reload your controllers and models after launching the console run <tt>reload!</tt>
128
115
 
116
+ To reload your controllers and models after launching the console run <tt>reload!</tt>
117
+
129
118
 
130
119
 
131
120
  == Description of contents
@@ -134,25 +123,29 @@ app
134
123
  Holds all the code that's specific to this particular application.
135
124
 
136
125
  app/controllers
137
- Holds controllers that should be named like weblog_controller.rb for
138
- automated URL mapping. All controllers should descend from
139
- ActionController::Base.
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.
140
129
 
141
130
  app/models
142
131
  Holds models that should be named like post.rb.
143
132
  Most models will descend from ActiveRecord::Base.
144
-
133
+
145
134
  app/views
146
135
  Holds the template files for the view that should be named like
147
- weblog/index.rhtml for the WeblogController#index action. All views use eRuby
148
- syntax. This directory can also be used to keep stylesheets, images, and so on
149
- that can be symlinked to public.
150
-
151
- app/helpers
152
- Holds view helpers that should be named like weblog_helper.rb.
136
+ weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby
137
+ syntax.
153
138
 
154
- app/apis
155
- Holds API classes for web services.
139
+ app/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.rhtml. Inside default.rhtml,
143
+ call <% yield %> to render the view using this layout.
144
+
145
+ app/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.
156
149
 
157
150
  config
158
151
  Configuration files for the Rails environment, the routing map, the database, and other dependencies.
@@ -164,19 +157,25 @@ db
164
157
  Contains the database schema in schema.rb. db/migrate contains all
165
158
  the sequence of Migrations for your schema.
166
159
 
160
+ doc
161
+ This directory is where your application documentation will be stored when generated
162
+ using <tt>rake doc:app</tt>
163
+
167
164
  lib
168
165
  Application specific libraries. Basically, any kind of custom code that doesn't
169
166
  belong under controllers, models, or helpers. This directory is in the load path.
170
-
167
+
171
168
  public
172
169
  The directory available for the web server. Contains subdirectories for images, stylesheets,
173
- and javascripts. Also contains the dispatchers and the default HTML files.
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.
174
172
 
175
173
  script
176
174
  Helper scripts for automation and generation.
177
175
 
178
176
  test
179
- Unit and functional tests along with fixtures.
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.
180
179
 
181
180
  vendor
182
181
  External libraries that the application depends on. Also includes the plugins subdirectory.