rails 2.1.2 → 2.2.2

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 (221) hide show
  1. data/CHANGELOG +27 -3
  2. data/Rakefile +70 -10
  3. data/bin/about +0 -0
  4. data/bin/console +0 -0
  5. data/bin/destroy +0 -0
  6. data/bin/generate +0 -0
  7. data/bin/performance/benchmarker +0 -0
  8. data/bin/performance/profiler +0 -0
  9. data/bin/performance/request +0 -0
  10. data/bin/plugin +0 -0
  11. data/bin/process/inspector +0 -0
  12. data/bin/process/reaper +0 -0
  13. data/bin/process/spawner +0 -0
  14. data/bin/runner +0 -0
  15. data/bin/server +0 -0
  16. data/config.ru +17 -0
  17. data/configs/apache.conf +0 -0
  18. data/configs/databases/ibm_db.yml +62 -0
  19. data/configs/databases/mysql.yml +3 -0
  20. data/configs/databases/postgresql.yml +3 -0
  21. data/configs/databases/sqlite2.yml +3 -0
  22. data/configs/databases/sqlite3.yml +3 -0
  23. data/configs/locales/en.yml +5 -0
  24. data/dispatches/dispatch.fcgi +1 -1
  25. data/dispatches/dispatch.rb +2 -2
  26. data/dispatches/gateway.cgi +2 -2
  27. data/doc/README_FOR_APP +5 -2
  28. data/doc/guides/html/2_2_release_notes.html +1185 -0
  29. data/doc/guides/html/actioncontroller_basics.html +1270 -0
  30. data/doc/guides/html/activerecord_validations_callbacks.html +749 -0
  31. data/doc/guides/html/association_basics.html +2585 -0
  32. data/doc/guides/html/authors.html +240 -0
  33. data/doc/guides/html/benchmarking_and_profiling.html +1018 -0
  34. data/doc/guides/html/caching_with_rails.html +583 -0
  35. data/doc/guides/html/command_line.html +434 -0
  36. data/doc/guides/html/configuring.html +438 -0
  37. data/doc/guides/html/creating_plugins.html +1594 -0
  38. data/doc/guides/html/debugging_rails_applications.html +1175 -0
  39. data/doc/guides/html/finders.html +1090 -0
  40. data/doc/guides/html/form_helpers.html +638 -0
  41. data/doc/guides/html/getting_started_with_rails.html +2066 -0
  42. data/doc/guides/html/index.html +349 -0
  43. data/doc/guides/html/layouts_and_rendering.html +1406 -0
  44. data/doc/guides/html/migrations.html +921 -0
  45. data/doc/guides/html/routing_outside_in.html +2213 -0
  46. data/doc/guides/html/security.html +1346 -0
  47. data/doc/guides/html/testing_rails_applications.html +1859 -0
  48. data/doc/guides/source/2_2_release_notes.txt +435 -0
  49. data/doc/guides/source/actioncontroller_basics/changelog.txt +5 -0
  50. data/doc/guides/source/actioncontroller_basics/cookies.txt +34 -0
  51. data/doc/guides/source/actioncontroller_basics/csrf.txt +32 -0
  52. data/doc/guides/source/actioncontroller_basics/filters.txt +119 -0
  53. data/doc/guides/source/actioncontroller_basics/http_auth.txt +24 -0
  54. data/doc/guides/source/actioncontroller_basics/index.txt +40 -0
  55. data/doc/guides/source/actioncontroller_basics/introduction.txt +9 -0
  56. data/doc/guides/source/actioncontroller_basics/methods.txt +39 -0
  57. data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +14 -0
  58. data/doc/guides/source/actioncontroller_basics/params.txt +93 -0
  59. data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +43 -0
  60. data/doc/guides/source/actioncontroller_basics/rescue.txt +67 -0
  61. data/doc/guides/source/actioncontroller_basics/session.txt +187 -0
  62. data/doc/guides/source/actioncontroller_basics/streaming.txt +91 -0
  63. data/doc/guides/source/actioncontroller_basics/verification.txt +40 -0
  64. data/doc/guides/source/active_record_basics.txt +181 -0
  65. data/doc/guides/source/activerecord_validations_callbacks.txt +404 -0
  66. data/doc/guides/source/association_basics.txt +1840 -0
  67. data/doc/guides/source/authors.txt +39 -0
  68. data/doc/guides/source/benchmarking_and_profiling/appendix.txt +95 -0
  69. data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +105 -0
  70. data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +185 -0
  71. data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +27 -0
  72. data/doc/guides/source/benchmarking_and_profiling/index.txt +242 -0
  73. data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +179 -0
  74. data/doc/guides/source/benchmarking_and_profiling/statistics.txt +57 -0
  75. data/doc/guides/source/caching_with_rails.txt +367 -0
  76. data/doc/guides/source/command_line.txt +147 -0
  77. data/doc/guides/source/configuring.txt +225 -0
  78. data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +191 -0
  79. data/doc/guides/source/creating_plugins/appendix.txt +46 -0
  80. data/doc/guides/source/creating_plugins/controllers.txt +59 -0
  81. data/doc/guides/source/creating_plugins/core_ext.txt +123 -0
  82. data/doc/guides/source/creating_plugins/custom_route.txt +69 -0
  83. data/doc/guides/source/creating_plugins/gem.txt +1 -0
  84. data/doc/guides/source/creating_plugins/generator_method.txt +89 -0
  85. data/doc/guides/source/creating_plugins/helpers.txt +51 -0
  86. data/doc/guides/source/creating_plugins/index.txt +52 -0
  87. data/doc/guides/source/creating_plugins/migration_generator.txt +156 -0
  88. data/doc/guides/source/creating_plugins/models.txt +76 -0
  89. data/doc/guides/source/creating_plugins/odds_and_ends.txt +69 -0
  90. data/doc/guides/source/creating_plugins/test_setup.txt +230 -0
  91. data/doc/guides/source/debugging_rails_applications.txt +733 -0
  92. data/doc/guides/source/finders.txt +668 -0
  93. data/doc/guides/source/form_helpers.txt +345 -0
  94. data/doc/guides/source/getting_started_with_rails.txt +1256 -0
  95. data/doc/guides/source/images/belongs_to.png +0 -0
  96. data/doc/guides/source/images/bullet.gif +0 -0
  97. data/doc/guides/source/images/csrf.png +0 -0
  98. data/doc/guides/source/images/habtm.png +0 -0
  99. data/doc/guides/source/images/has_many.png +0 -0
  100. data/doc/guides/source/images/has_many_through.png +0 -0
  101. data/doc/guides/source/images/has_one.png +0 -0
  102. data/doc/guides/source/images/has_one_through.png +0 -0
  103. data/doc/guides/source/images/header_backdrop.png +0 -0
  104. data/doc/guides/source/images/icons/README +5 -0
  105. data/doc/guides/source/images/icons/callouts/1.png +0 -0
  106. data/doc/guides/source/images/icons/callouts/10.png +0 -0
  107. data/doc/guides/source/images/icons/callouts/11.png +0 -0
  108. data/doc/guides/source/images/icons/callouts/12.png +0 -0
  109. data/doc/guides/source/images/icons/callouts/13.png +0 -0
  110. data/doc/guides/source/images/icons/callouts/14.png +0 -0
  111. data/doc/guides/source/images/icons/callouts/15.png +0 -0
  112. data/doc/guides/source/images/icons/callouts/2.png +0 -0
  113. data/doc/guides/source/images/icons/callouts/3.png +0 -0
  114. data/doc/guides/source/images/icons/callouts/4.png +0 -0
  115. data/doc/guides/source/images/icons/callouts/5.png +0 -0
  116. data/doc/guides/source/images/icons/callouts/6.png +0 -0
  117. data/doc/guides/source/images/icons/callouts/7.png +0 -0
  118. data/doc/guides/source/images/icons/callouts/8.png +0 -0
  119. data/doc/guides/source/images/icons/callouts/9.png +0 -0
  120. data/doc/guides/source/images/icons/caution.png +0 -0
  121. data/doc/guides/source/images/icons/example.png +0 -0
  122. data/doc/guides/source/images/icons/home.png +0 -0
  123. data/doc/guides/source/images/icons/important.png +0 -0
  124. data/doc/guides/source/images/icons/next.png +0 -0
  125. data/doc/guides/source/images/icons/note.png +0 -0
  126. data/doc/guides/source/images/icons/prev.png +0 -0
  127. data/doc/guides/source/images/icons/tip.png +0 -0
  128. data/doc/guides/source/images/icons/up.png +0 -0
  129. data/doc/guides/source/images/icons/warning.png +0 -0
  130. data/doc/guides/source/images/polymorphic.png +0 -0
  131. data/doc/guides/source/images/rails_logo_remix.gif +0 -0
  132. data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
  133. data/doc/guides/source/images/session_fixation.png +0 -0
  134. data/doc/guides/source/index.txt +118 -0
  135. data/doc/guides/source/layouts_and_rendering.txt +982 -0
  136. data/doc/guides/source/migrations/anatomy_of_a_migration.txt +85 -0
  137. data/doc/guides/source/migrations/changelog.txt +5 -0
  138. data/doc/guides/source/migrations/creating_a_migration.txt +109 -0
  139. data/doc/guides/source/migrations/foreign_keys.txt +8 -0
  140. data/doc/guides/source/migrations/index.txt +22 -0
  141. data/doc/guides/source/migrations/rakeing_around.txt +111 -0
  142. data/doc/guides/source/migrations/scheming.txt +47 -0
  143. data/doc/guides/source/migrations/using_models_in_migrations.txt +46 -0
  144. data/doc/guides/source/migrations/writing_a_migration.txt +159 -0
  145. data/doc/guides/source/routing_outside_in.txt +986 -0
  146. data/doc/guides/source/security.txt +984 -0
  147. data/doc/guides/source/stylesheets/base.css +358 -0
  148. data/doc/guides/source/stylesheets/forms.css +35 -0
  149. data/doc/guides/source/stylesheets/more.css +82 -0
  150. data/doc/guides/source/templates/guides.html.erb +97 -0
  151. data/doc/guides/source/templates/inline.css +165 -0
  152. data/doc/guides/source/testing_rails_applications.txt +995 -0
  153. data/environments/boot.rb +2 -2
  154. data/environments/environment.rb +9 -1
  155. data/environments/production.rb +3 -1
  156. data/helpers/performance_test.rb +9 -0
  157. data/html/500.html +4 -1
  158. data/html/javascripts/controls.js +72 -72
  159. data/html/javascripts/dragdrop.js +165 -164
  160. data/html/javascripts/effects.js +173 -165
  161. data/html/javascripts/prototype.js +362 -267
  162. data/lib/commands/console.rb +13 -0
  163. data/lib/commands/dbconsole.rb +2 -2
  164. data/lib/commands/ncgi/listener +2 -2
  165. data/lib/commands/ncgi/tracker +2 -2
  166. data/lib/commands/plugin.rb +41 -24
  167. data/lib/commands/process/spawner.rb +4 -4
  168. data/lib/commands/runner.rb +1 -1
  169. data/lib/commands/server.rb +11 -1
  170. data/lib/commands/servers/thin.rb +25 -0
  171. data/lib/fcgi_handler.rb +1 -3
  172. data/lib/initializer.rb +162 -39
  173. data/lib/performance_test_help.rb +5 -0
  174. data/lib/rails/gem_builder.rb +3 -3
  175. data/lib/rails/gem_dependency.rb +155 -33
  176. data/lib/rails/mongrel_server/commands.rb +1 -1
  177. data/lib/rails/plugin.rb +10 -2
  178. data/lib/rails/rack.rb +6 -0
  179. data/lib/rails/rack/logger.rb +28 -0
  180. data/lib/rails/rack/static.rb +35 -0
  181. data/lib/rails/vendor_gem_source_index.rb +140 -0
  182. data/lib/rails/version.rb +1 -1
  183. data/lib/rails_generator/commands.rb +10 -16
  184. data/lib/rails_generator/generated_attribute.rb +4 -0
  185. data/lib/rails_generator/generators/applications/app/app_generator.rb +9 -3
  186. data/lib/rails_generator/generators/components/controller/controller_generator.rb +1 -1
  187. data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +1 -1
  188. data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +1 -1
  189. data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +2 -2
  190. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +1 -1
  191. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +2 -3
  192. data/lib/rails_generator/generators/components/model/model_generator.rb +1 -1
  193. data/lib/rails_generator/generators/components/model/templates/model.rb +3 -0
  194. data/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -1
  195. data/lib/rails_generator/generators/components/observer/observer_generator.rb +1 -1
  196. data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +1 -1
  197. data/lib/rails_generator/generators/components/performance_test/USAGE +8 -0
  198. data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +16 -0
  199. data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +9 -0
  200. data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +11 -11
  201. data/lib/rails_generator/generators/components/plugin/templates/Rakefile +1 -0
  202. data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +3 -0
  203. data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +4 -4
  204. data/lib/rails_generator/generators/components/resource/resource_generator.rb +2 -2
  205. data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +1 -1
  206. data/lib/rails_generator/generators/components/scaffold/USAGE +9 -5
  207. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +10 -3
  208. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +7 -7
  209. data/lib/rails_generator/scripts.rb +1 -1
  210. data/lib/rails_generator/scripts/destroy.rb +6 -7
  211. data/lib/rails_generator/secret_key_generator.rb +5 -147
  212. data/lib/tasks/annotations.rake +8 -11
  213. data/lib/tasks/databases.rake +42 -15
  214. data/lib/tasks/documentation.rake +15 -0
  215. data/lib/tasks/framework.rake +5 -1
  216. data/lib/tasks/gems.rake +24 -8
  217. data/lib/tasks/misc.rake +3 -4
  218. data/lib/tasks/testing.rake +25 -4
  219. data/lib/test_help.rb +1 -2
  220. data/lib/webrick_server.rb +2 -11
  221. metadata +165 -9
data/CHANGELOG CHANGED
@@ -1,9 +1,31 @@
1
- *2.1.2 (October 23rd, 2008)*
1
+ *2.2 (November 21st, 2008)*
2
2
 
3
- * Security fixes for Active Record and Action Pack and a few other minor fixes
3
+ * Added config.i18n settings gatherer to config/environment, auto-loading of all locales in config/locales/*.rb,yml, and config/locales/en.yml as a sample locale [DHH]
4
4
 
5
+ * Fixed plugin generator so that generated unit tests would subclass ActiveSupport::TestCase, also introduced a helper script to reduce the needed require statements #1137 [Mathias Meyer]
5
6
 
6
- *2.1.1 (September 4th, 2008)*
7
+ * Update Prototype to 1.6.0.4 [sam]
8
+
9
+ * Fixed that sqlite would report "db/development.sqlite3 already exists" whether true or not on db:create #614 [Antonio Cangiano]
10
+
11
+ * Added config.threadsafe! to toggle allow concurrency settings and disable the dependency loader [Josh Peek]
12
+
13
+ * Turn cache_classes on by default [Josh Peek]
14
+
15
+ * Added configurable eager load paths. Defaults to app/models, app/controllers, and app/helpers [Josh Peek]
16
+
17
+ * Introduce simple internationalization support. [Ruby i18n team]
18
+
19
+ * Make script/plugin install <plugin> -r <revision> option work with git based plugins. #257. [Tim Pope Jakub Kuźma]. Example:
20
+
21
+ script/plugin install git://github.com/mislav/will_paginate.git -r agnostic # Installs 'agnostic' branch
22
+ script/plugin install git://github.com/dchelimsky/rspec.git -r 'tag 1.1.4'
23
+
24
+ * Added Rails.initialized? flag [Josh Peek]
25
+
26
+ * Make rake test:uncommitted work with Git. [Tim Pope]
27
+
28
+ * Added Thin support to script/server. #488 [Bob Klosinski]
7
29
 
8
30
  * Fix script/about in production mode. #370 [Cheah Chu Yeow, Xavier Noria, David Krmpotic]
9
31
 
@@ -13,6 +35,8 @@
13
35
 
14
36
  * Plugins check for the gem init path (rails/init.rb) before the standard plugin init path (init.rb) [Jacek Becela]
15
37
 
38
+ * Changed all generated tests to use the test/do declaration style [DHH]
39
+
16
40
  * Wrapped Rails.env in StringInquirer so you can do Rails.env.development? [DHH]
17
41
 
18
42
  * Fixed that RailsInfoController wasn't considering all requests local in development mode (Edgard Castro) [#310 state:resolved]
data/Rakefile CHANGED
@@ -2,7 +2,6 @@ require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
4
  require 'rake/gempackagetask'
5
- require 'rake/contrib/sshpublisher'
6
5
  require 'rake/contrib/rubyforgepublisher'
7
6
 
8
7
  require 'date'
@@ -45,6 +44,7 @@ BASE_DIRS = %w(
45
44
  app
46
45
  config/environments
47
46
  config/initializers
47
+ config/locales
48
48
  components
49
49
  db
50
50
  doc
@@ -193,13 +193,15 @@ task :copy_configs do
193
193
  app_name = "rails"
194
194
  socket = nil
195
195
  require 'erb'
196
- File.open("#{PKG_DESTINATION}/config/database.yml", 'w') {|f| f.write ERB.new(IO.read("configs/databases/mysql.yml"), nil, '-').result(binding)}
196
+ File.open("#{PKG_DESTINATION}/config/database.yml", 'w') {|f| f.write ERB.new(IO.read("configs/databases/sqlite3.yml"), nil, '-').result(binding)}
197
197
 
198
198
  cp "configs/routes.rb", "#{PKG_DESTINATION}/config/routes.rb"
199
199
 
200
200
  cp "configs/initializers/inflections.rb", "#{PKG_DESTINATION}/config/initializers/inflections.rb"
201
201
  cp "configs/initializers/mime_types.rb", "#{PKG_DESTINATION}/config/initializers/mime_types.rb"
202
202
 
203
+ cp "configs/locales/en.yml", "#{PKG_DESTINATION}/config/locales/en.yml"
204
+
203
205
  cp "environments/boot.rb", "#{PKG_DESTINATION}/config/boot.rb"
204
206
  cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
205
207
  cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
@@ -273,6 +275,59 @@ Rake::RDocTask.new { |rdoc|
273
275
  rdoc.rdoc_files.include('lib/commands/**/*.rb')
274
276
  }
275
277
 
278
+ desc "Generate guides for the framework"
279
+ task :guides do
280
+ require 'mizuho/generator'
281
+
282
+ source = "doc/guides/source/"
283
+ html = "doc/guides/html/"
284
+ FileUtils.rm_r(html) if File.directory?(html)
285
+ FileUtils.mkdir(html)
286
+
287
+ template = File.expand_path("doc/guides/source/templates/guides.html.erb")
288
+
289
+ ignore = ['..', 'icons', 'images', 'templates', 'stylesheets']
290
+ ignore << 'active_record_basics.txt'
291
+
292
+ indexless = ['index.txt', 'authors.txt']
293
+
294
+ # Traverse all entries in doc/guides/source/
295
+ Dir.entries(source).each do |entry|
296
+ next if ignore.include?(entry)
297
+
298
+ if File.directory?(File.join(source, entry))
299
+ # If the current entry is a directory, then we will want to compile
300
+ # the 'index.txt' file inside this directory.
301
+ if entry == '.'
302
+ input = File.join(source, 'index.txt')
303
+ output = File.join(html, "index.html")
304
+ else
305
+ input = File.join(source, entry, 'index.txt')
306
+ output = File.join(html, "#{entry}.html")
307
+ end
308
+ else
309
+ # If the current entry is a file, then we will want to compile this file.
310
+ input = File.join(source, entry)
311
+ output = File.join(html, entry).sub(/\.txt$/, '.html')
312
+ end
313
+
314
+ begin
315
+ puts "GENERATING => #{output}"
316
+ ENV['MANUALSONRAILS_TOC'] = 'no' if indexless.include?(entry)
317
+ Mizuho::Generator.new(input, :output => output, :template => template).start
318
+ rescue Mizuho::GenerationError
319
+ STDERR.puts "*** ERROR"
320
+ exit 2
321
+ ensure
322
+ ENV.delete('MANUALSONRAILS_TOC')
323
+ end
324
+ end
325
+
326
+ # Copy images and css files to html directory. These dirs are in .gitigore and shouldn't be source controlled.
327
+ FileUtils.cp_r File.join(source, 'images'), File.join(html, 'images')
328
+ FileUtils.cp_r File.join(source, 'stylesheets'), File.join(html, 'stylesheets')
329
+ end
330
+
276
331
  # Generate GEM ----------------------------------------------------------------------------
277
332
 
278
333
  task :copy_gem_environment do
@@ -305,12 +360,12 @@ spec = Gem::Specification.new do |s|
305
360
  on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
306
361
  EOF
307
362
 
308
- s.add_dependency('rake', '>= 0.8.1')
309
- s.add_dependency('activesupport', '= 2.1.2' + PKG_BUILD)
310
- s.add_dependency('activerecord', '= 2.1.2' + PKG_BUILD)
311
- s.add_dependency('actionpack', '= 2.1.2' + PKG_BUILD)
312
- s.add_dependency('actionmailer', '= 2.1.2' + PKG_BUILD)
313
- s.add_dependency('activeresource', '= 2.1.2' + PKG_BUILD)
363
+ s.add_dependency('rake', '>= 0.8.3')
364
+ s.add_dependency('activesupport', '= 2.2.2' + PKG_BUILD)
365
+ s.add_dependency('activerecord', '= 2.2.2' + PKG_BUILD)
366
+ s.add_dependency('actionpack', '= 2.2.2' + PKG_BUILD)
367
+ s.add_dependency('actionmailer', '= 2.2.2' + PKG_BUILD)
368
+ s.add_dependency('activeresource', '= 2.2.2' + PKG_BUILD)
314
369
 
315
370
  s.rdoc_options << '--exclude' << '.'
316
371
  s.has_rdoc = false
@@ -335,8 +390,13 @@ end
335
390
  # Publishing -------------------------------------------------------
336
391
  desc "Publish the rails gem"
337
392
  task :pgem => [:gem] do
338
- Rake::SshFilePublisher.new("david@greed.loudthinking.com", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
339
- `ssh david@greed.loudthinking.com '/u/sites/gems/gemupdate.sh'`
393
+ Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
394
+ `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
395
+ end
396
+
397
+ desc "Publish the API documentation"
398
+ task :pdoc => :rdoc do
399
+ # railties API isn't separately published
340
400
  end
341
401
 
342
402
  desc "Publish the release files to RubyForge."
data/bin/about CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/bin/plugin CHANGED
File without changes
File without changes
File without changes
File without changes
data/bin/runner CHANGED
File without changes
data/bin/server CHANGED
File without changes
@@ -0,0 +1,17 @@
1
+ # Rackup Configuration
2
+ #
3
+ # Start Rails mongrel server with rackup
4
+ # $ rackup -p 3000 config.ru
5
+ #
6
+ # Start server with webrick (or any compatible Rack server) instead
7
+ # $ rackup -p 3000 -s webrick config.ru
8
+
9
+ # Require your environment file to bootstrap Rails
10
+ require File.dirname(__FILE__) + '/config/environment'
11
+
12
+ # Static server middleware
13
+ # You can remove this extra check if you use an asset server
14
+ use Rails::Rack::Static
15
+
16
+ # Dispatch the request
17
+ run ActionController::Dispatcher.new
File without changes
@@ -0,0 +1,62 @@
1
+ # IBM Dataservers
2
+ #
3
+ # Home Page
4
+ # http://rubyforge.org/projects/rubyibm/
5
+ #
6
+ # To install the ibm_db gem:
7
+ # On Linux:
8
+ # Source the db2profile file and set the necessary environment variables:
9
+ #
10
+ # . /home/db2inst1/sqllib/db2profile
11
+ # export IBM_DB_DIR=/opt/ibm/db2/V9.1
12
+ # export IBM_DB_LIB=/opt/ibm/db2/V9.1/lib32
13
+ #
14
+ # Then issue the command: gem install ibm_db
15
+ #
16
+ # On Windows:
17
+ # Issue the command: gem install ibm_db
18
+ # If prompted, select the mswin32 option
19
+ #
20
+ # For more details on the installation refer to http://rubyforge.org/docman/view.php/2361/7682/IBM_DB_GEM.pdf
21
+ #
22
+ # For more details on the connection parameters below refer to:
23
+ # http://rubyibm.rubyforge.org/docs/adapter/0.9.0/rdoc/classes/ActiveRecord/ConnectionAdapters/IBM_DBAdapter.html
24
+
25
+ development:
26
+ adapter: ibm_db
27
+ username: db2inst1
28
+ password:
29
+ database: <%= app_name[0,4] %>_dev
30
+ #schema: db2inst1
31
+ #host: localhost
32
+ #port: 50000
33
+ #account: my_account
34
+ #app_user: my_app_user
35
+ #application: my_application
36
+ #workstation: my_workstation
37
+
38
+ test:
39
+ adapter: ibm_db
40
+ username: db2inst1
41
+ password:
42
+ database: <%= app_name[0,4] %>_tst
43
+ #schema: db2inst1
44
+ #host: localhost
45
+ #port: 50000
46
+ #account: my_account
47
+ #app_user: my_app_user
48
+ #application: my_application
49
+ #workstation: my_workstation
50
+
51
+ production:
52
+ adapter: ibm_db
53
+ username: db2inst1
54
+ password:
55
+ database: <%= app_name[0,4] %>_prd
56
+ #schema: db2inst1
57
+ #host: localhost
58
+ #port: 50000
59
+ #account: my_account
60
+ #app_user: my_app_user
61
+ #application: my_application
62
+ #workstation: my_workstation
@@ -18,6 +18,7 @@ development:
18
18
  adapter: mysql
19
19
  encoding: utf8
20
20
  database: <%= app_name %>_development
21
+ pool: 5
21
22
  username: root
22
23
  password:
23
24
  <% if socket -%>
@@ -33,6 +34,7 @@ test:
33
34
  adapter: mysql
34
35
  encoding: utf8
35
36
  database: <%= app_name %>_test
37
+ pool: 5
36
38
  username: root
37
39
  password:
38
40
  <% if socket -%>
@@ -45,6 +47,7 @@ production:
45
47
  adapter: mysql
46
48
  encoding: utf8
47
49
  database: <%= app_name %>_production
50
+ pool: 5
48
51
  username: root
49
52
  password:
50
53
  <% if socket -%>
@@ -12,6 +12,7 @@ development:
12
12
  adapter: postgresql
13
13
  encoding: unicode
14
14
  database: <%= app_name %>_development
15
+ pool: 5
15
16
  username: <%= app_name %>
16
17
  password:
17
18
 
@@ -37,6 +38,7 @@ test:
37
38
  adapter: postgresql
38
39
  encoding: unicode
39
40
  database: <%= app_name %>_test
41
+ pool: 5
40
42
  username: <%= app_name %>
41
43
  password:
42
44
 
@@ -44,5 +46,6 @@ production:
44
46
  adapter: postgresql
45
47
  encoding: unicode
46
48
  database: <%= app_name %>_production
49
+ pool: 5
47
50
  username: <%= app_name %>
48
51
  password:
@@ -3,6 +3,7 @@
3
3
  development:
4
4
  adapter: sqlite
5
5
  database: db/development.sqlite2
6
+ pool: 5
6
7
 
7
8
  # Warning: The database defined as "test" will be erased and
8
9
  # re-generated from your development database when you run "rake".
@@ -10,7 +11,9 @@ development:
10
11
  test:
11
12
  adapter: sqlite
12
13
  database: db/test.sqlite2
14
+ pool: 5
13
15
 
14
16
  production:
15
17
  adapter: sqlite
16
18
  database: db/production.sqlite2
19
+ pool: 5
@@ -3,6 +3,7 @@
3
3
  development:
4
4
  adapter: sqlite3
5
5
  database: db/development.sqlite3
6
+ pool: 5
6
7
  timeout: 5000
7
8
 
8
9
  # Warning: The database defined as "test" will be erased and
@@ -11,9 +12,11 @@ development:
11
12
  test:
12
13
  adapter: sqlite3
13
14
  database: db/test.sqlite3
15
+ pool: 5
14
16
  timeout: 5000
15
17
 
16
18
  production:
17
19
  adapter: sqlite3
18
20
  database: db/production.sqlite3
21
+ pool: 5
19
22
  timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  #
3
3
  # You may specify the path to the FastCGI crash log (a log of unhandled
4
4
  # exceptions which forced the FastCGI instance to exit, great for debugging)
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
4
 
@@ -7,4 +7,4 @@ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_
7
7
  require "dispatcher"
8
8
 
9
9
  ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
- Dispatcher.dispatch
10
+ Dispatcher.dispatch
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'drb'
4
4
 
@@ -94,4 +94,4 @@ end
94
94
 
95
95
  $stdout.write output
96
96
  $stdout.flush
97
- $stdout.close
97
+ $stdout.close
@@ -1,2 +1,5 @@
1
- Use this README file to introduce your application and point to useful places in the API for learning more.
2
- Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
1
+ To build the guides:
2
+
3
+ * Install source-highlighter (http://www.gnu.org/software/src-highlite/source-highlight.html)
4
+ * Install the mizuho gem (http://github.com/FooBarWidget/mizuho/tree/master)
5
+ * Run `rake guides` from the railties directory
@@ -0,0 +1,1185 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <title>Ruby on Rails 2.2 Release Notes</title>
6
+ <!--[if lt IE 8]>
7
+ <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
8
+ <![endif]-->
9
+ <link href="stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" />
10
+ <link href="stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" />
11
+ <link href="stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" />
12
+ <style type="text/css">
13
+ div#container {
14
+ max-width: 900px;
15
+ padding-bottom: 3em;
16
+ }
17
+
18
+ div#content {
19
+ margin-left: 200px;
20
+ }
21
+
22
+ div#container.notoc {
23
+ max-width: 600px;
24
+ }
25
+
26
+ .notoc div#content {
27
+ margin-left: 0;
28
+ }
29
+
30
+ pre {
31
+ line-height: 1.4em;
32
+ }
33
+
34
+ #content p tt {
35
+ background: #eeeeee;
36
+ border: solid 1px #cccccc;
37
+ padding: 3px;
38
+ }
39
+
40
+ dt {
41
+ font-weight: bold;
42
+ }
43
+ #
44
+ #content dt tt {
45
+ font-size: 10pt;
46
+ }
47
+
48
+ dd {
49
+ margin-left: 3em;
50
+ }
51
+
52
+ #content dt tt, #content pre tt {
53
+ background: none;
54
+ padding: 0;
55
+ border: 0;
56
+ }
57
+
58
+ #content .olist ol {
59
+ margin-left: 2em;
60
+ }
61
+
62
+ #header {
63
+ position: relative;
64
+ max-width: 840px;
65
+ margin-left: auto;
66
+ margin-right: auto;
67
+ }
68
+
69
+ #header.notoc {
70
+ max-width: 580px;
71
+ }
72
+
73
+ #logo {
74
+ position: absolute;
75
+ left: 10px;
76
+ top: 10px;
77
+ width: 110px;
78
+ height: 140px;
79
+ }
80
+
81
+ div#header h1#site_title {
82
+ background: url('images/ruby_on_rails_by_mike_rundle2.gif') top left no-repeat;
83
+ position: absolute;
84
+ width: 392px;
85
+ height: 55px;
86
+ left: 145px;
87
+ top: 20px;
88
+ margin: 0;
89
+ padding: 0;
90
+ }
91
+
92
+ #site_title span {
93
+ display: none;
94
+ }
95
+
96
+ #site_title_tagline {
97
+ display: none;
98
+ }
99
+
100
+ ul#navMain {
101
+ position: absolute;
102
+ margin: 0;
103
+ padding: 0;
104
+ top: 97px;
105
+ left: 145px;
106
+ }
107
+
108
+ .left-floaty, .right-floaty {
109
+ padding: 15px;
110
+ }
111
+
112
+ .admonitionblock,
113
+ .tableblock {
114
+ margin-left: 1em;
115
+ margin-right: 1em;
116
+ margin-top: 0.25em;
117
+ margin-bottom: 1em;
118
+ }
119
+
120
+ .admonitionblock .icon {
121
+ padding-right: 8px;
122
+ }
123
+
124
+ .admonitionblock .content {
125
+ border: solid 1px #ffda78;
126
+ background: #fffebd;
127
+ padding: 10px;
128
+ padding-top: 8px;
129
+ padding-bottom: 8px;
130
+ }
131
+
132
+ .admonitionblock .title {
133
+ font-size: 140%;
134
+ margin-bottom: 0.5em;
135
+ }
136
+
137
+ .tableblock table {
138
+ border: solid 1px #aaaaff;
139
+ background: #f0f0ff;
140
+ }
141
+
142
+ .tableblock th {
143
+ background: #e0e0e0;
144
+ }
145
+
146
+ .tableblock th,
147
+ .tableblock td {
148
+ padding: 3px;
149
+ padding-left: 5px;
150
+ padding-right: 5px;
151
+ }
152
+
153
+ .sidebarblock {
154
+ margin-top: 0.25em;
155
+ margin: 1em;
156
+ border: solid 1px #ccccbb;
157
+ padding: 8px;
158
+ background: #ffffe0;
159
+ }
160
+
161
+ .sidebarblock .sidebar-title {
162
+ font-size: 140%;
163
+ font-weight: 600;
164
+ margin-bottom: 0.3em;
165
+ }
166
+
167
+ .sidebarblock .sidebar-content > .para:last-child > p {
168
+ margin-bottom: 0;
169
+ }
170
+
171
+ .sidebarblock .sidebar-title a {
172
+ text-decoration: none;
173
+ }
174
+
175
+ .sidebarblock .sidebar-title a:hover {
176
+ text-decoration: underline;
177
+ }
178
+
179
+ </style>
180
+ </head>
181
+ <body>
182
+ <div id="header" >
183
+ <div id="logo">
184
+ <a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a>
185
+ </div>
186
+
187
+ <h1 id="site_title"><span>Ruby on Rails</span></h1>
188
+ <h2 id="site_title_tagline">Sustainable productivity for web-application development</h2>
189
+
190
+ <ul id="navMain">
191
+ <li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li>
192
+ <li><a class="manuals" href="index.html" title="Manuals Index">Guides Index</a></li>
193
+ </ul>
194
+ </div>
195
+
196
+ <div id="container">
197
+
198
+ <div id="sidebar">
199
+ <h2>Chapters</h2>
200
+ <ol>
201
+ <li>
202
+ <a href="#_infrastructure">Infrastructure</a>
203
+ <ul>
204
+
205
+ <li><a href="#_internationalization">Internationalization</a></li>
206
+
207
+ <li><a href="#_compatibility_with_ruby_1_9_and_jruby">Compatibility with Ruby 1.9 and JRuby</a></li>
208
+
209
+ </ul>
210
+ </li>
211
+ <li>
212
+ <a href="#_documentation">Documentation</a>
213
+ </li>
214
+ <li>
215
+ <a href="#_better_integration_with_http_out_of_the_box_etag_support">Better integration with HTTP : Out of the box ETag support</a>
216
+ </li>
217
+ <li>
218
+ <a href="#_thread_safety">Thread Safety</a>
219
+ </li>
220
+ <li>
221
+ <a href="#_active_record">Active Record</a>
222
+ <ul>
223
+
224
+ <li><a href="#_transactional_migrations">Transactional Migrations</a></li>
225
+
226
+ <li><a href="#_connection_pooling">Connection Pooling</a></li>
227
+
228
+ <li><a href="#_hashes_for_join_table_conditions">Hashes for Join Table Conditions</a></li>
229
+
230
+ <li><a href="#_new_dynamic_finders">New Dynamic Finders</a></li>
231
+
232
+ <li><a href="#_associations_respect_private_protected_scope">Associations Respect Private/Protected Scope</a></li>
233
+
234
+ <li><a href="#_other_activerecord_changes">Other ActiveRecord Changes</a></li>
235
+
236
+ </ul>
237
+ </li>
238
+ <li>
239
+ <a href="#_action_controller">Action Controller</a>
240
+ <ul>
241
+
242
+ <li><a href="#_shallow_route_nesting">Shallow Route Nesting</a></li>
243
+
244
+ <li><a href="#_method_arrays_for_member_or_collection_routes">Method Arrays for Member or Collection Routes</a></li>
245
+
246
+ <li><a href="#_resources_with_specific_actions">Resources With Specific Actions</a></li>
247
+
248
+ <li><a href="#_other_action_controller_changes">Other Action Controller Changes</a></li>
249
+
250
+ </ul>
251
+ </li>
252
+ <li>
253
+ <a href="#_action_view">Action View</a>
254
+ </li>
255
+ <li>
256
+ <a href="#_action_mailer">Action Mailer</a>
257
+ </li>
258
+ <li>
259
+ <a href="#_active_support">Active Support</a>
260
+ <ul>
261
+
262
+ <li><a href="#_memoization">Memoization</a></li>
263
+
264
+ <li><a href="#_tt_each_with_object_tt"><tt>each_with_object</tt></a></li>
265
+
266
+ <li><a href="#_delegates_with_prefixes">Delegates With Prefixes</a></li>
267
+
268
+ <li><a href="#_other_active_support_changes">Other Active Support Changes</a></li>
269
+
270
+ </ul>
271
+ </li>
272
+ <li>
273
+ <a href="#_railties">Railties</a>
274
+ <ul>
275
+
276
+ <li><a href="#_tt_config_gems_tt"><tt>config.gems</tt></a></li>
277
+
278
+ <li><a href="#_other_railties_changes">Other Railties Changes</a></li>
279
+
280
+ </ul>
281
+ </li>
282
+ <li>
283
+ <a href="#_deprecated">Deprecated</a>
284
+ </li>
285
+ <li>
286
+ <a href="#_credits">Credits</a>
287
+ </li>
288
+ </ol>
289
+ </div>
290
+
291
+ <div id="content">
292
+ <h1>Ruby on Rails 2.2 Release Notes</h1>
293
+ <div id="preamble">
294
+ <div class="sectionbody">
295
+ <div class="para"><p>Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub.</p></div>
296
+ <div class="para"><p>Along with Rails, 2.2 marks the launch of the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a>, the first results of the ongoing <a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>. This site will deliver high-quality documentation of the major features of Rails.</p></div>
297
+ </div>
298
+ </div>
299
+ <h2 id="_infrastructure">1. Infrastructure</h2>
300
+ <div class="sectionbody">
301
+ <div class="para"><p>Rails 2.2 is a significant release for the infrastructure that keeps Rails humming along and connected to the rest of the world.</p></div>
302
+ <h3 id="_internationalization">1.1. Internationalization</h3>
303
+ <div class="para"><p>Rails 2.2 supplies an easy system for internationalization (or i18n, for those of you tired of typing).</p></div>
304
+ <div class="ilist"><ul>
305
+ <li>
306
+ <p>
307
+ Lead Contributors: Rails i18 Team
308
+ </p>
309
+ </li>
310
+ <li>
311
+ <p>
312
+ More information :
313
+ </p>
314
+ <div class="ilist"><ul>
315
+ <li>
316
+ <p>
317
+ <a href="http://rails-i18n.org">Official Rails i18 website</a>
318
+ </p>
319
+ </li>
320
+ <li>
321
+ <p>
322
+ <a href="http://www.artweb-design.de/2008/7/18/finally-ruby-on-rails-gets-internationalized">Finally. Ruby on Rails gets internationalized</a>
323
+ </p>
324
+ </li>
325
+ <li>
326
+ <p>
327
+ <a href="http://i18n-demo.phusion.nl">Localizing Rails : Demo application</a>
328
+ </p>
329
+ </li>
330
+ </ul></div>
331
+ </li>
332
+ </ul></div>
333
+ <h3 id="_compatibility_with_ruby_1_9_and_jruby">1.2. Compatibility with Ruby 1.9 and JRuby</h3>
334
+ <div class="para"><p>Along with thread safety, a lot of work has been done to make Rails work well with JRuby and the upcoming Ruby 1.9. With Ruby 1.9 being a moving target, running edge Rails on edge Ruby is still a hit-or-miss proposition, but Rails is ready to make the transition to Ruby 1.9 when the latter is released.</p></div>
335
+ </div>
336
+ <h2 id="_documentation">2. Documentation</h2>
337
+ <div class="sectionbody">
338
+ <div class="para"><p>The internal documentation of Rails, in the form of code comments, has been improved in numerous places. In addition, the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a> project is the definitive source for information on major Rails components. In its first official release, the Guides page includes:</p></div>
339
+ <div class="ilist"><ul>
340
+ <li>
341
+ <p>
342
+ <a href="http://guides.rubyonrails.org/getting_started_with_rails.html">Getting Started with Rails</a>
343
+ </p>
344
+ </li>
345
+ <li>
346
+ <p>
347
+ <a href="http://guides.rubyonrails.org/migrations.html">Rails Database Migrations</a>
348
+ </p>
349
+ </li>
350
+ <li>
351
+ <p>
352
+ <a href="http://guides.rubyonrails.org/association_basics.html">Active Record Associations</a>
353
+ </p>
354
+ </li>
355
+ <li>
356
+ <p>
357
+ <a href="http://guides.rubyonrails.org/finders.html">Active Record Finders</a>
358
+ </p>
359
+ </li>
360
+ <li>
361
+ <p>
362
+ <a href="http://guides.rubyonrails.org/layouts_and_rendering.html">Layouts and Rendering in Rails</a>
363
+ </p>
364
+ </li>
365
+ <li>
366
+ <p>
367
+ <a href="http://guides.rubyonrails.org/form_helpers.html">Action View Form Helpers</a>
368
+ </p>
369
+ </li>
370
+ <li>
371
+ <p>
372
+ <a href="http://guides.rubyonrails.org/routing_outside_in.html">Rails Routing from the Outside In</a>
373
+ </p>
374
+ </li>
375
+ <li>
376
+ <p>
377
+ <a href="http://guides.rubyonrails.org/actioncontroller_basics.html">Basics of Action Controller</a>
378
+ </p>
379
+ </li>
380
+ <li>
381
+ <p>
382
+ <a href="http://guides.rubyonrails.org/caching_with_rails.html">Rails Caching</a>
383
+ </p>
384
+ </li>
385
+ <li>
386
+ <p>
387
+ <a href="http://guides.rubyonrails.org/testing_rails_applications.html">Testing Rails Applications</a>
388
+ </p>
389
+ </li>
390
+ <li>
391
+ <p>
392
+ <a href="http://guides.rubyonrails.org/security.html">Securing Rails Applications</a>
393
+ </p>
394
+ </li>
395
+ <li>
396
+ <p>
397
+ <a href="http://guides.rubyonrails.org/debugging_rails_applications.html">Debugging Rails Applications</a>
398
+ </p>
399
+ </li>
400
+ <li>
401
+ <p>
402
+ <a href="http://guides.rubyonrails.org/benchmarking_and_profiling.html">Benchmarking and Profiling Rails Applications</a>
403
+ </p>
404
+ </li>
405
+ <li>
406
+ <p>
407
+ <a href="http://guides.rubyonrails.org/creating_plugins.html">The Basics of Creating Rails Plugins</a>
408
+ </p>
409
+ </li>
410
+ </ul></div>
411
+ <div class="para"><p>All told, the Guides provide tens of thousands of words of guidance for beginning and intermediate Rails developers.</p></div>
412
+ <div class="para"><p>If you want to generate these guides locally, inside your application:</p></div>
413
+ <div class="listingblock">
414
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
415
+ by Lorenzo Bettini
416
+ http://www.lorenzobettini.it
417
+ http://www.gnu.org/software/src-highlite -->
418
+ <pre><tt>rake doc<span style="color: #990000">:</span>guides
419
+ </tt></pre></div></div>
420
+ <div class="para"><p>This will put the guides inside <tt>RAILS_ROOT/doc/guides</tt> and you may start surfing straight away by opening <tt>RAILS_ROOT/doc/guides/index.html</tt> in your favourite browser.</p></div>
421
+ <div class="ilist"><ul>
422
+ <li>
423
+ <p>
424
+ Lead Contributors: <a href="http://guides.rails.info/authors.html">Rails Documentation Team</a>
425
+ </p>
426
+ </li>
427
+ <li>
428
+ <p>
429
+ Major contributions from <a href="http://advogato.org/person/fxn/diary.html">Xavier Noria</a> and <a href="http://izumi.plan99.net/blog/">Hongli Lai</a>.
430
+ </p>
431
+ </li>
432
+ <li>
433
+ <p>
434
+ More information:
435
+ </p>
436
+ <div class="ilist"><ul>
437
+ <li>
438
+ <p>
439
+ <a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>
440
+ </p>
441
+ </li>
442
+ <li>
443
+ <p>
444
+ <a href="http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch">Help improve Rails documentation on Git branch</a>
445
+ </p>
446
+ </li>
447
+ </ul></div>
448
+ </li>
449
+ </ul></div>
450
+ </div>
451
+ <h2 id="_better_integration_with_http_out_of_the_box_etag_support">3. Better integration with HTTP : Out of the box ETag support</h2>
452
+ <div class="sectionbody">
453
+ <div class="para"><p>Supporting the etag and last modified timestamp in HTTP headers means that Rails can now send back an empty response if it gets a request for a resource that hasn't been modified lately. This allows you to check whether a response needs to be sent at all.</p></div>
454
+ <div class="listingblock">
455
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
456
+ by Lorenzo Bettini
457
+ http://www.lorenzobettini.it
458
+ http://www.gnu.org/software/src-highlite -->
459
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> ArticlesController <span style="color: #990000">&lt;</span> ApplicationController
460
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> show_with_respond_to_block
461
+ <span style="color: #009900">@article</span> <span style="color: #990000">=</span> Article<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">])</span>
462
+
463
+ <span style="font-style: italic"><span style="color: #9A1900"># If the request sends headers that differs from the options provided to stale?, then</span></span>
464
+ <span style="font-style: italic"><span style="color: #9A1900"># the request is indeed stale and the respond_to block is triggered (and the options</span></span>
465
+ <span style="font-style: italic"><span style="color: #9A1900"># to the stale? call is set on the response).</span></span>
466
+ <span style="font-style: italic"><span style="color: #9A1900">#</span></span>
467
+ <span style="font-style: italic"><span style="color: #9A1900"># If the request headers match, then the request is fresh and the respond_to block is</span></span>
468
+ <span style="font-style: italic"><span style="color: #9A1900"># not triggered. Instead the default render will occur, which will check the last-modified</span></span>
469
+ <span style="font-style: italic"><span style="color: #9A1900"># and etag headers and conclude that it only needs to send a "304 Not Modified" instead</span></span>
470
+ <span style="font-style: italic"><span style="color: #9A1900"># of rendering the template.</span></span>
471
+ <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> stale?<span style="color: #990000">(:</span>last_modified <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">.</span>published_at<span style="color: #990000">.</span>utc<span style="color: #990000">,</span> <span style="color: #990000">:</span>etag <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">)</span>
472
+ respond_to <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>wants<span style="color: #990000">|</span>
473
+ <span style="font-style: italic"><span style="color: #9A1900"># normal response processing</span></span>
474
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
475
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
476
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
477
+
478
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> show_with_implied_render
479
+ <span style="color: #009900">@article</span> <span style="color: #990000">=</span> Article<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">])</span>
480
+
481
+ <span style="font-style: italic"><span style="color: #9A1900"># Sets the response headers and checks them against the request, if the request is stale</span></span>
482
+ <span style="font-style: italic"><span style="color: #9A1900"># (i.e. no match of either etag or last-modified), then the default render of the template happens.</span></span>
483
+ <span style="font-style: italic"><span style="color: #9A1900"># If the request is fresh, then the default render will return a "304 Not Modified"</span></span>
484
+ <span style="font-style: italic"><span style="color: #9A1900"># instead of rendering the template.</span></span>
485
+ fresh_when<span style="color: #990000">(:</span>last_modified <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">.</span>published_at<span style="color: #990000">.</span>utc<span style="color: #990000">,</span> <span style="color: #990000">:</span>etag <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">)</span>
486
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
487
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
488
+ </tt></pre></div></div>
489
+ </div>
490
+ <h2 id="_thread_safety">4. Thread Safety</h2>
491
+ <div class="sectionbody">
492
+ <div class="para"><p>The work done to make Rails thread-safe is rolling out in Rails 2.2. Depending on your web server infrastructure, this means you can handle more requests with fewer copies of Rails in memory, leading to better server performance and higher utilization of multiple cores.</p></div>
493
+ <div class="para"><p>To enable multithreaded dispatching in production mode of your application, add the following line in your <tt>config/environments/production.rb</tt>:</p></div>
494
+ <div class="listingblock">
495
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
496
+ by Lorenzo Bettini
497
+ http://www.lorenzobettini.it
498
+ http://www.gnu.org/software/src-highlite -->
499
+ <pre><tt>config<span style="color: #990000">.</span>threadsafe!
500
+ </tt></pre></div></div>
501
+ <div class="ilist"><ul>
502
+ <li>
503
+ <p>
504
+ More information :
505
+ </p>
506
+ <div class="ilist"><ul>
507
+ <li>
508
+ <p>
509
+ <a href="http://m.onkey.org/2008/10/23/thread-safety-for-your-rails">Thread safety for your Rails</a>
510
+ </p>
511
+ </li>
512
+ <li>
513
+ <p>
514
+ <a href="http://weblog.rubyonrails.org/2008/8/16/josh-peek-officially-joins-the-rails-core">Thread safety project announcement</a>
515
+ </p>
516
+ </li>
517
+ <li>
518
+ <p>
519
+ <a href="http://blog.headius.com/2008/08/qa-what-thread-safe-rails-means.html">Q/A: What Thread-safe Rails Means</a>
520
+ </p>
521
+ </li>
522
+ </ul></div>
523
+ </li>
524
+ </ul></div>
525
+ </div>
526
+ <h2 id="_active_record">5. Active Record</h2>
527
+ <div class="sectionbody">
528
+ <div class="para"><p>There are two big additions to talk about here: transactional migrations and pooled database transactions. There's also a new (and cleaner) syntax for join table conditions, as well as a number of smaller improvements.</p></div>
529
+ <h3 id="_transactional_migrations">5.1. Transactional Migrations</h3>
530
+ <div class="para"><p>Historically, multiple-step Rails migrations have been a source of trouble. If something went wrong during a migration, everything before the error changed the database and everything after the error wasn't applied. Also, the migration version was stored as having been executed, which means that it couldn't be simply rerun by <tt>rake db:migrate:redo</tt> after you fix the problem. Transactional migrations change this by wrapping migration steps in a DDL transaction, so that if any of them fail, the entire migration is undone. In Rails 2.2, transactional migrations are supported on PostgreSQL out of the box. The code is extensible to other database types in the future - and IBM has already extended it to support the DB2 adapter.</p></div>
531
+ <div class="ilist"><ul>
532
+ <li>
533
+ <p>
534
+ Lead Contributor: <a href="http://adam.blog.heroku.com/">Adam Wiggins</a>
535
+ </p>
536
+ </li>
537
+ <li>
538
+ <p>
539
+ More information:
540
+ </p>
541
+ <div class="ilist"><ul>
542
+ <li>
543
+ <p>
544
+ <a href="http://adam.blog.heroku.com/past/2008/9/3/ddl_transactions/">DDL Transactions</a>
545
+ </p>
546
+ </li>
547
+ <li>
548
+ <p>
549
+ <a href="http://db2onrails.com/2008/11/08/a-major-milestone-for-db2-on-rails/">A major milestone for DB2 on Rails</a>
550
+ </p>
551
+ </li>
552
+ </ul></div>
553
+ </li>
554
+ </ul></div>
555
+ <h3 id="_connection_pooling">5.2. Connection Pooling</h3>
556
+ <div class="para"><p>Connection pooling lets Rails distribute database requests across a pool of database connections that will grow to a maximum size (by default 5, but you can add a <tt>pool</tt> key to your <tt>database.yml</tt> to adjust this). This helps remove bottlenecks in applications that support many concurrent users. There's also a <tt>wait_timeout</tt> that defaults to 5 seconds before giving up. <tt>ActiveRecord::Base.connection_pool</tt> gives you direct access to the pool if you need it.</p></div>
557
+ <div class="listingblock">
558
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
559
+ by Lorenzo Bettini
560
+ http://www.lorenzobettini.it
561
+ http://www.gnu.org/software/src-highlite -->
562
+ <pre><tt>development<span style="color: #990000">:</span>
563
+ adapter<span style="color: #990000">:</span> mysql
564
+ username<span style="color: #990000">:</span> root
565
+ database<span style="color: #990000">:</span> sample_development
566
+ pool<span style="color: #990000">:</span> <span style="color: #993399">10</span>
567
+ wait_timeout<span style="color: #990000">:</span> <span style="color: #993399">10</span>
568
+ </tt></pre></div></div>
569
+ <div class="ilist"><ul>
570
+ <li>
571
+ <p>
572
+ Lead Contributor: <a href="http://blog.nicksieger.com/">Nick Sieger</a>
573
+ </p>
574
+ </li>
575
+ <li>
576
+ <p>
577
+ More information:
578
+ </p>
579
+ <div class="ilist"><ul>
580
+ <li>
581
+ <p>
582
+ <a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-connection-pools">What's New in Edge Rails: Connection Pools</a>
583
+ </p>
584
+ </li>
585
+ </ul></div>
586
+ </li>
587
+ </ul></div>
588
+ <h3 id="_hashes_for_join_table_conditions">5.3. Hashes for Join Table Conditions</h3>
589
+ <div class="para"><p>You can now specify conditions on join tables using a hash. This is a big help if you need to query across complex joins.</p></div>
590
+ <div class="listingblock">
591
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
592
+ by Lorenzo Bettini
593
+ http://www.lorenzobettini.it
594
+ http://www.gnu.org/software/src-highlite -->
595
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Photo <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
596
+ belongs_to <span style="color: #990000">:</span>product
597
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
598
+
599
+ <span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Product <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
600
+ has_many <span style="color: #990000">:</span>photos
601
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
602
+
603
+ <span style="font-style: italic"><span style="color: #9A1900"># Get all products with copyright-free photos:</span></span>
604
+ Product<span style="color: #990000">.</span>all<span style="color: #990000">(:</span>joins <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>photos <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>copyright <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">false</span></span> <span style="color: #FF0000">}}</span><span style="color: #990000">)</span>
605
+ </tt></pre></div></div>
606
+ <div class="ilist"><ul>
607
+ <li>
608
+ <p>
609
+ More information:
610
+ </p>
611
+ <div class="ilist"><ul>
612
+ <li>
613
+ <p>
614
+ <a href="http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-easy-join-table-conditions">What's New in Edge Rails: Easy Join Table Conditions</a>
615
+ </p>
616
+ </li>
617
+ </ul></div>
618
+ </li>
619
+ </ul></div>
620
+ <h3 id="_new_dynamic_finders">5.4. New Dynamic Finders</h3>
621
+ <div class="para"><p>Two new sets of methods have been added to Active Record's dynamic finders family.</p></div>
622
+ <h4 id="_tt_find_last_by_lt_attribute_gt_tt">5.4.1. <tt>find_last_by_&lt;attribute&gt;</tt></h4>
623
+ <div class="para"><p>The <tt>find_last_by_&lt;attribute&gt;</tt> method is equivalent to <tt>Model.last(:conditions &#8658; {:attribute &#8658; value})</tt></p></div>
624
+ <div class="listingblock">
625
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
626
+ by Lorenzo Bettini
627
+ http://www.lorenzobettini.it
628
+ http://www.gnu.org/software/src-highlite -->
629
+ <pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Get the last user who signed up from London</span></span>
630
+ User<span style="color: #990000">.</span>find_last_by_city<span style="color: #990000">(</span><span style="color: #FF0000">'London'</span><span style="color: #990000">)</span>
631
+ </tt></pre></div></div>
632
+ <div class="ilist"><ul>
633
+ <li>
634
+ <p>
635
+ Lead Contributor: <a href="http://www.workingwithrails.com/person/9147-emilio-tagua">Emilio Tagua</a>
636
+ </p>
637
+ </li>
638
+ </ul></div>
639
+ <h4 id="_tt_find_by_lt_attribute_gt_tt">5.4.2. <tt>find_by_&lt;attribute&gt;!</tt></h4>
640
+ <div class="para"><p>The new bang! version of <tt>find_by_&lt;attribute&gt;!</tt> is equivalent to <tt>Model.first(:conditions &#8658; {:attribute &#8658; value}) || raise ActiveRecord::RecordNotFound</tt> Instead of returning <tt>nil</tt> if it can't find a matching record, this method will raise an exception if it cannot find a match.</p></div>
641
+ <div class="listingblock">
642
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
643
+ by Lorenzo Bettini
644
+ http://www.lorenzobettini.it
645
+ http://www.gnu.org/software/src-highlite -->
646
+ <pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Raise ActiveRecord::RecordNotFound exception if 'Moby' hasn't signed up yet!</span></span>
647
+ User<span style="color: #990000">.</span>find_by_name!<span style="color: #990000">(</span><span style="color: #FF0000">'Moby'</span><span style="color: #990000">)</span>
648
+ </tt></pre></div></div>
649
+ <div class="ilist"><ul>
650
+ <li>
651
+ <p>
652
+ Lead Contributor: <a href="http://blog.hasmanythrough.com">Josh Susser</a>
653
+ </p>
654
+ </li>
655
+ </ul></div>
656
+ <h3 id="_associations_respect_private_protected_scope">5.5. Associations Respect Private/Protected Scope</h3>
657
+ <div class="para"><p>Active Record association proxies now respect the scope of methods on the proxied object. Previously (given User has_one :account) <tt>@user.account.private_method</tt> would call the private method on the associated Account object. That fails in Rails 2.2; if you need this functionality, you should use <tt>@user.account.send(:private_method)</tt> (or make the method public instead of private or protected). Please note that if you're overriding <tt>method_missing</tt>, you should also override <tt>respond_to</tt> to match the behavior in order for associations to function normally.</p></div>
658
+ <div class="ilist"><ul>
659
+ <li>
660
+ <p>
661
+ Lead Contributor: Adam Milligan
662
+ </p>
663
+ </li>
664
+ <li>
665
+ <p>
666
+ More information:
667
+ </p>
668
+ <div class="ilist"><ul>
669
+ <li>
670
+ <p>
671
+ <a href="http://afreshcup.com/2008/10/24/rails-22-change-private-methods-on-association-proxies-are-private/">Rails 2.2 Change: Private Methods on Association Proxies are Private</a>
672
+ </p>
673
+ </li>
674
+ </ul></div>
675
+ </li>
676
+ </ul></div>
677
+ <h3 id="_other_activerecord_changes">5.6. Other ActiveRecord Changes</h3>
678
+ <div class="ilist"><ul>
679
+ <li>
680
+ <p>
681
+ <tt>rake db:migrate:redo</tt> now accepts an optional VERSION to target that specific migration to redo
682
+ </p>
683
+ </li>
684
+ <li>
685
+ <p>
686
+ Set <tt>config.active_record.timestamped_migrations = false</tt> to have migrations with numeric prefix instead of UTC timestamp.
687
+ </p>
688
+ </li>
689
+ <li>
690
+ <p>
691
+ Counter cache columns (for associations declared with <tt>:counter_cache &#8658; true</tt>) do not need to be initialized to zero any longer.
692
+ </p>
693
+ </li>
694
+ <li>
695
+ <p>
696
+ <tt>ActiveRecord::Base.human_name</tt> for an internationalization-aware humane translation of model names
697
+ </p>
698
+ </li>
699
+ </ul></div>
700
+ </div>
701
+ <h2 id="_action_controller">6. Action Controller</h2>
702
+ <div class="sectionbody">
703
+ <div class="para"><p>On the controller side, there are several changes that will help tidy up your routes. There are also some internal changes in the routing engine to lower memory usage on complex applications.</p></div>
704
+ <h3 id="_shallow_route_nesting">6.1. Shallow Route Nesting</h3>
705
+ <div class="para"><p>Shallow route nesting provides a solution to the well-known difficulty of using deeply-nested resources. With shallow nesting, you need only supply enough information to uniquely identify the resource that you want to work with.</p></div>
706
+ <div class="listingblock">
707
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
708
+ by Lorenzo Bettini
709
+ http://www.lorenzobettini.it
710
+ http://www.gnu.org/software/src-highlite -->
711
+ <pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>publishers<span style="color: #990000">,</span> <span style="color: #990000">:</span>shallow <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>publisher<span style="color: #990000">|</span>
712
+ publisher<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>magazines <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>magazine<span style="color: #990000">|</span>
713
+ magazine<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos
714
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
715
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
716
+ </tt></pre></div></div>
717
+ <div class="para"><p>This will enable recognition of (among others) these routes:</p></div>
718
+ <div class="listingblock">
719
+ <div class="content">
720
+ <pre><tt>/publishers/1 ==&gt; publisher_path(1)
721
+ /publishers/1/magazines ==&gt; publisher_magazines_path(1)
722
+ /magazines/2 ==&gt; magazine_path(2)
723
+ /magazines/2/photos ==&gt; magazines_photos_path(2)
724
+ /photos/3 ==&gt; photo_path(3)</tt></pre>
725
+ </div></div>
726
+ <div class="ilist"><ul>
727
+ <li>
728
+ <p>
729
+ Lead Contributor: <a href="http://www.unwwwired.net/">S. Brent Faulkner</a>
730
+ </p>
731
+ </li>
732
+ <li>
733
+ <p>
734
+ More information:
735
+ </p>
736
+ <div class="ilist"><ul>
737
+ <li>
738
+ <p>
739
+ <a href="http://guides.rails.info/routing/routing_outside_in.html#_nested_resources">Rails Routing from the Outside In</a>
740
+ </p>
741
+ </li>
742
+ <li>
743
+ <p>
744
+ <a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes">What's New in Edge Rails: Shallow Routes</a>
745
+ </p>
746
+ </li>
747
+ </ul></div>
748
+ </li>
749
+ </ul></div>
750
+ <h3 id="_method_arrays_for_member_or_collection_routes">6.2. Method Arrays for Member or Collection Routes</h3>
751
+ <div class="para"><p>You can now supply an array of methods for new member or collection routes. This removes the annoyance of having to define a route as accepting any verb as soon as you need it to handle more than one. With Rails 2.2, this is a legitimate route declaration:</p></div>
752
+ <div class="listingblock">
753
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
754
+ by Lorenzo Bettini
755
+ http://www.lorenzobettini.it
756
+ http://www.gnu.org/software/src-highlite -->
757
+ <pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>collection <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>search <span style="color: #990000">=&gt;</span> <span style="color: #990000">[:</span>get<span style="color: #990000">,</span> <span style="color: #990000">:</span>post<span style="color: #990000">]</span> <span style="color: #FF0000">}</span>
758
+ </tt></pre></div></div>
759
+ <div class="ilist"><ul>
760
+ <li>
761
+ <p>
762
+ Lead Contributor: <a href="http://brennandunn.com/">Brennan Dunn</a>
763
+ </p>
764
+ </li>
765
+ </ul></div>
766
+ <h3 id="_resources_with_specific_actions">6.3. Resources With Specific Actions</h3>
767
+ <div class="para"><p>By default, when you use <tt>map.resources</tt> to create a route, Rails generates routes for seven default actions (index, show, create, new, edit, update, and destroy). But each of these routes takes up memory in your application, and causes Rails to generate additional routing logic. Now you can use the <tt>:only</tt> and <tt>:except</tt> options to fine-tune the routes that Rails will generate for resources. You can supply a single action, an array of actions, or the special <tt>:all</tt> or <tt>:none</tt> options. These options are inherited by nested resources.</p></div>
768
+ <div class="listingblock">
769
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
770
+ by Lorenzo Bettini
771
+ http://www.lorenzobettini.it
772
+ http://www.gnu.org/software/src-highlite -->
773
+ <pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>only <span style="color: #990000">=&gt;</span> <span style="color: #990000">[:</span>index<span style="color: #990000">,</span> <span style="color: #990000">:</span>show<span style="color: #990000">]</span>
774
+ map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>products<span style="color: #990000">,</span> <span style="color: #990000">:</span>except <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>destroy
775
+ </tt></pre></div></div>
776
+ <div class="ilist"><ul>
777
+ <li>
778
+ <p>
779
+ Lead Contributor: <a href="http://experthuman.com/">Tom Stuart</a>
780
+ </p>
781
+ </li>
782
+ </ul></div>
783
+ <h3 id="_other_action_controller_changes">6.4. Other Action Controller Changes</h3>
784
+ <div class="ilist"><ul>
785
+ <li>
786
+ <p>
787
+ You can now easily <a href="http://m.onkey.org/2008/7/20/rescue-from-dispatching">show a custom error page</a> for exceptions raised while routing a request.
788
+ </p>
789
+ </li>
790
+ <li>
791
+ <p>
792
+ The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as <tt>/customers/1.xml</tt>) to indicate the format that you want. If you need the Accept headers, you can turn them back on with <tt>config.action_controller.user_accept_header = true</tt>.
793
+ </p>
794
+ </li>
795
+ <li>
796
+ <p>
797
+ Benchmarking numbers are now reported in milliseconds rather than tiny fractions of seconds
798
+ </p>
799
+ </li>
800
+ <li>
801
+ <p>
802
+ Rails now supports HTTP-only cookies (and uses them for sessions), which help mitigate some cross-site scripting risks in newer browsers.
803
+ </p>
804
+ </li>
805
+ <li>
806
+ <p>
807
+ <tt>redirect_to</tt> now fully supports URI schemes (so, for example, you can redirect to a svn+ssh: URI).
808
+ </p>
809
+ </li>
810
+ <li>
811
+ <p>
812
+ <tt>render</tt> now supports a <tt>:js</tt> option to render plain vanilla javascript with the right mime type.
813
+ </p>
814
+ </li>
815
+ <li>
816
+ <p>
817
+ Request forgery protection has been tightened up to apply to HTML-formatted content requests only.
818
+ </p>
819
+ </li>
820
+ <li>
821
+ <p>
822
+ Polymorphic URLs behave more sensibly if a passed parameter is nil. For example, calling <tt>polymorphic_path([@project, @date, @area])</tt> with a nil date will give you <tt>project_area_path</tt>.
823
+ </p>
824
+ </li>
825
+ </ul></div>
826
+ </div>
827
+ <h2 id="_action_view">7. Action View</h2>
828
+ <div class="sectionbody">
829
+ <div class="ilist"><ul>
830
+ <li>
831
+ <p>
832
+ <tt>javascript_include_tag</tt> and <tt>stylesheet_link_tag</tt> support a new <tt>:recursive</tt> option to be used along with <tt>:all</tt>, so that you can load an entire tree of files with a single line of code.
833
+ </p>
834
+ </li>
835
+ <li>
836
+ <p>
837
+ The included Prototype javascript library has been upgraded to version 1.6.0.3.
838
+ </p>
839
+ </li>
840
+ <li>
841
+ <p>
842
+ <tt>RJS#page.reload</tt> to reload the browser's current location via javascript
843
+ </p>
844
+ </li>
845
+ <li>
846
+ <p>
847
+ The <tt>atom_feed</tt> helper now takes an <tt>:instruct</tt> option to let you insert XML processing instructions.
848
+ </p>
849
+ </li>
850
+ </ul></div>
851
+ </div>
852
+ <h2 id="_action_mailer">8. Action Mailer</h2>
853
+ <div class="sectionbody">
854
+ <div class="para"><p>Action Mailer now supports mailer layouts. You can make your HTML emails as pretty as your in-browser views by supplying an appropriately-named layout - for example, the <tt>CustomerMailer</tt> class expects to use <tt>layouts/customer_mailer.html.erb</tt>.</p></div>
855
+ <div class="ilist"><ul>
856
+ <li>
857
+ <p>
858
+ More information:
859
+ </p>
860
+ <div class="ilist"><ul>
861
+ <li>
862
+ <p>
863
+ <a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-mailer-layouts">What's New in Edge Rails: Mailer Layouts</a>
864
+ </p>
865
+ </li>
866
+ </ul></div>
867
+ </li>
868
+ </ul></div>
869
+ <div class="para"><p>Action Mailer now offers built-in support for GMail's SMTP servers, by turning on STARTTLS automatically. This requires Ruby 1.8.7 to be installed.</p></div>
870
+ </div>
871
+ <h2 id="_active_support">9. Active Support</h2>
872
+ <div class="sectionbody">
873
+ <div class="para"><p>Active Support now offers built-in memoization for Rails applications, the <tt>each_with_object</tt> method, prefix support on delegates, and various other new utility methods.</p></div>
874
+ <h3 id="_memoization">9.1. Memoization</h3>
875
+ <div class="para"><p>Memoization is a pattern of initializing a method once and then stashing its value away for repeat use. You've probably used this pattern in your own applications:</p></div>
876
+ <div class="listingblock">
877
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
878
+ by Lorenzo Bettini
879
+ http://www.lorenzobettini.it
880
+ http://www.gnu.org/software/src-highlite -->
881
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> full_name
882
+ <span style="color: #009900">@full_name</span> <span style="color: #990000">||=</span> <span style="color: #FF0000">"#{first_name} #{last_name}"</span>
883
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
884
+ </tt></pre></div></div>
885
+ <div class="para"><p>Memoization lets you handle this task in a declarative fashion:</p></div>
886
+ <div class="listingblock">
887
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
888
+ by Lorenzo Bettini
889
+ http://www.lorenzobettini.it
890
+ http://www.gnu.org/software/src-highlite -->
891
+ <pre><tt>extend ActiveSupport<span style="color: #990000">::</span>Memoizable
892
+
893
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> full_name
894
+ <span style="color: #FF0000">"#{first_name} #{last_name}"</span>
895
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
896
+ memoize <span style="color: #990000">:</span>full_name
897
+ </tt></pre></div></div>
898
+ <div class="para"><p>Other features of memoization include <tt>unmemoize</tt>, <tt>unmemoize_all</tt>, and <tt>memoize_all</tt> to turn memoization on or off.</p></div>
899
+ <div class="ilist"><ul>
900
+ <li>
901
+ <p>
902
+ Lead Contributor: <a href="http://joshpeek.com/">Josh Peek</a>
903
+ </p>
904
+ </li>
905
+ <li>
906
+ <p>
907
+ More information:
908
+ </p>
909
+ <div class="ilist"><ul>
910
+ <li>
911
+ <p>
912
+ <a href="http://ryandaigle.com/articles/2008/7/16/what-s-new-in-edge-rails-memoization">What's New in Edge Rails: Easy Memoization</a>
913
+ </p>
914
+ </li>
915
+ <li>
916
+ <p>
917
+ <a href="http://www.railway.at/articles/2008/09/20/a-guide-to-memoization">Memo-what? A Guide to Memoization</a>
918
+ </p>
919
+ </li>
920
+ </ul></div>
921
+ </li>
922
+ </ul></div>
923
+ <h3 id="_tt_each_with_object_tt">9.2. <tt>each_with_object</tt></h3>
924
+ <div class="para"><p>The <tt>each_with_object</tt> method provides an alternative to <tt>inject</tt>, using a method backported from Ruby 1.9. It iterates over a collection, passing the current element and the memo into the block.</p></div>
925
+ <div class="listingblock">
926
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
927
+ by Lorenzo Bettini
928
+ http://www.lorenzobettini.it
929
+ http://www.gnu.org/software/src-highlite -->
930
+ <pre><tt><span style="color: #990000">%</span>w<span style="color: #990000">(</span>foo bar<span style="color: #990000">).</span>each_with_object<span style="color: #990000">(</span><span style="color: #FF0000">{}</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span> <span style="color: #990000">|</span>str<span style="color: #990000">,</span> hsh<span style="color: #990000">|</span> hsh<span style="color: #990000">[</span>str<span style="color: #990000">]</span> <span style="color: #990000">=</span> str<span style="color: #990000">.</span>upcase <span style="color: #FF0000">}</span> <span style="font-style: italic"><span style="color: #9A1900">#=&gt; {'foo' =&gt; 'FOO', 'bar' =&gt; 'BAR'}</span></span>
931
+ </tt></pre></div></div>
932
+ <div class="para"><p>Lead Contributor: <a href="http://therealadam.com/">Adam Keys</a></p></div>
933
+ <h3 id="_delegates_with_prefixes">9.3. Delegates With Prefixes</h3>
934
+ <div class="para"><p>If you delegate behavior from one class to another, you can now specify a prefix that will be used to identify the delegated methods. For example:</p></div>
935
+ <div class="listingblock">
936
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
937
+ by Lorenzo Bettini
938
+ http://www.lorenzobettini.it
939
+ http://www.gnu.org/software/src-highlite -->
940
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Vendor <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
941
+ has_one <span style="color: #990000">:</span>account
942
+ delegate <span style="color: #990000">:</span>email<span style="color: #990000">,</span> <span style="color: #990000">:</span>password<span style="color: #990000">,</span> <span style="color: #990000">:</span>to <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>account<span style="color: #990000">,</span> <span style="color: #990000">:</span>prefix <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
943
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
944
+ </tt></pre></div></div>
945
+ <div class="para"><p>This will produce delegated methods <tt>vendor#account_email</tt> and <tt>vendor#account_password</tt>. You can also specify a custom prefix:</p></div>
946
+ <div class="listingblock">
947
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
948
+ by Lorenzo Bettini
949
+ http://www.lorenzobettini.it
950
+ http://www.gnu.org/software/src-highlite -->
951
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Vendor <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
952
+ has_one <span style="color: #990000">:</span>account
953
+ delegate <span style="color: #990000">:</span>email<span style="color: #990000">,</span> <span style="color: #990000">:</span>password<span style="color: #990000">,</span> <span style="color: #990000">:</span>to <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>account<span style="color: #990000">,</span> <span style="color: #990000">:</span>prefix <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>owner
954
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
955
+ </tt></pre></div></div>
956
+ <div class="para"><p>This will produce delegated methods <tt>vendor#owner_email</tt> and <tt>vendor#owner_password</tt>.</p></div>
957
+ <div class="para"><p>Lead Contributor: <a href="http://workingwithrails.com/person/5830-daniel-schierbeck">Daniel Schierbeck</a></p></div>
958
+ <h3 id="_other_active_support_changes">9.4. Other Active Support Changes</h3>
959
+ <div class="ilist"><ul>
960
+ <li>
961
+ <p>
962
+ Extensive updates to <tt>ActiveSupport::Multibyte</tt>, including Ruby 1.9 compatibility fixes.
963
+ </p>
964
+ </li>
965
+ <li>
966
+ <p>
967
+ The addition of <tt>ActiveSupport::Rescuable</tt> allows any class to mix in the <tt>rescue_from</tt> syntax.
968
+ </p>
969
+ </li>
970
+ <li>
971
+ <p>
972
+ <tt>past?</tt>, <tt>today?</tt> and <tt>future?</tt> for <tt>Date</tt> and <tt>Time</tt> classes to facilitate date/time comparisons.
973
+ </p>
974
+ </li>
975
+ <li>
976
+ <p>
977
+ <tt>Array#second</tt> through <tt>Array#fifth</tt> as aliases for <tt>Array#[1]</tt> through <tt>Array#[4]</tt>
978
+ </p>
979
+ </li>
980
+ <li>
981
+ <p>
982
+ <tt>Enumerable#many?</tt> to encapsulate <tt>collection.size &gt; 1</tt>
983
+ </p>
984
+ </li>
985
+ <li>
986
+ <p>
987
+ <tt>Inflector#parameterize</tt> produces a URL-ready version of its input, for use in <tt>to_param</tt>.
988
+ </p>
989
+ </li>
990
+ <li>
991
+ <p>
992
+ <tt>Time#advance</tt> recognizes fractional days and weeks, so you can do <tt>1.7.weeks.ago</tt>, <tt>1.5.hours.since</tt>, and so on.
993
+ </p>
994
+ </li>
995
+ <li>
996
+ <p>
997
+ The included TzInfo library has been upgraded to version 0.3.12.
998
+ </p>
999
+ </li>
1000
+ <li>
1001
+ <p>
1002
+ <tt>ActiveSuport::StringInquirer</tt> gives you a pretty way to test for equality in strings: <tt>ActiveSupport::StringInquirer.new("abc").abc? &#8658; true</tt>
1003
+ </p>
1004
+ </li>
1005
+ </ul></div>
1006
+ </div>
1007
+ <h2 id="_railties">10. Railties</h2>
1008
+ <div class="sectionbody">
1009
+ <div class="para"><p>In Railties (the core code of Rails itself) the biggest changes are in the <tt>config.gems</tt> mechanism.</p></div>
1010
+ <h3 id="_tt_config_gems_tt">10.1. <tt>config.gems</tt></h3>
1011
+ <div class="para"><p>To avoid deployment issues and make Rails applications more self-contained, it's possible to place copies of all of the gems that your Rails application requires in <tt>/vendor/gems</tt>. This capability first appeared in Rails 2.1, but it's much more flexible and robust in Rails 2.2, handling complicated dependencies between gems. Gem management in Rails includes these commands:</p></div>
1012
+ <div class="ilist"><ul>
1013
+ <li>
1014
+ <p>
1015
+ <tt>config.gem <em>gem_name</em></tt> in your <tt>config/environment.rb</tt> file
1016
+ </p>
1017
+ </li>
1018
+ <li>
1019
+ <p>
1020
+ <tt>rake gems</tt> to list all configured gems, as well as whether they (and their dependencies) are installed or frozen
1021
+ </p>
1022
+ </li>
1023
+ <li>
1024
+ <p>
1025
+ <tt>rake gems:install</tt> to install missing gems to the computer
1026
+ </p>
1027
+ </li>
1028
+ <li>
1029
+ <p>
1030
+ <tt>rake gems:unpack</tt> to place a copy of the required gems into <tt>/vendor/gems</tt>
1031
+ </p>
1032
+ </li>
1033
+ <li>
1034
+ <p>
1035
+ <tt>rake gems:unpack:dependencies</tt> to get copies of the required gems and their dependencies into <tt>/vendor/gems</tt>
1036
+ </p>
1037
+ </li>
1038
+ <li>
1039
+ <p>
1040
+ <tt>rake gems:build</tt> to build any missing native extensions
1041
+ </p>
1042
+ </li>
1043
+ <li>
1044
+ <p>
1045
+ <tt>rake gems:refresh_specs</tt> to bring vendored gems created with Rails 2.1 into alignment with the Rails 2.2 way of storing them
1046
+ </p>
1047
+ </li>
1048
+ </ul></div>
1049
+ <div class="para"><p>You can unpack or install a single gem by specifying <tt>GEM=<em>gem_name</em></tt> on the command line.</p></div>
1050
+ <div class="ilist"><ul>
1051
+ <li>
1052
+ <p>
1053
+ Lead Contributor: <a href="http://github.com/al2o3cr">Matt Jones</a>
1054
+ </p>
1055
+ </li>
1056
+ <li>
1057
+ <p>
1058
+ More information:
1059
+ </p>
1060
+ <div class="ilist"><ul>
1061
+ <li>
1062
+ <p>
1063
+ <a href="http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies">What's New in Edge Rails: Gem Dependencies</a>
1064
+ </p>
1065
+ </li>
1066
+ <li>
1067
+ <p>
1068
+ <a href="http://afreshcup.com/2008/10/25/rails-212-and-22rc1-update-your-rubygems/">Rails 2.1.2 and 2.2RC1: Update Your RubyGems</a>
1069
+ </p>
1070
+ </li>
1071
+ </ul></div>
1072
+ </li>
1073
+ </ul></div>
1074
+ <h3 id="_other_railties_changes">10.2. Other Railties Changes</h3>
1075
+ <div class="ilist"><ul>
1076
+ <li>
1077
+ <p>
1078
+ If you're a fan of the <a href="http://code.macournoyer.com/thin/">Thin</a> web server, you'll be happy to know that <tt>script/server</tt> now supports Thin directly.
1079
+ </p>
1080
+ </li>
1081
+ <li>
1082
+ <p>
1083
+ <tt>script/plugin install &lt;plugin&gt; -r &lt;revision&gt;</tt> now works with git-based as well as svn-based plugins.
1084
+ </p>
1085
+ </li>
1086
+ <li>
1087
+ <p>
1088
+ <tt>script/console</tt> now supports a <tt>&#8212;debugger</tt> option
1089
+ </p>
1090
+ </li>
1091
+ <li>
1092
+ <p>
1093
+ Instructions for setting up a continuous integration server to build Rails itself are included in the Rails source
1094
+ </p>
1095
+ </li>
1096
+ <li>
1097
+ <p>
1098
+ <tt>rake notes:custom ANNOTATION=MYFLAG</tt> lets you list out custom annotations.
1099
+ </p>
1100
+ </li>
1101
+ <li>
1102
+ <p>
1103
+ Wrapped <tt>Rails.env</tt> in <tt>StringInquirer</tt> so you can do <tt>Rails.env.development?</tt>
1104
+ </p>
1105
+ </li>
1106
+ <li>
1107
+ <p>
1108
+ To eliminate deprecation warnings and properly handle gem dependencies, Rails now requires rubygems 1.3.1 or higher.
1109
+ </p>
1110
+ </li>
1111
+ </ul></div>
1112
+ </div>
1113
+ <h2 id="_deprecated">11. Deprecated</h2>
1114
+ <div class="sectionbody">
1115
+ <div class="para"><p>A few pieces of older code are deprecated in this release:</p></div>
1116
+ <div class="ilist"><ul>
1117
+ <li>
1118
+ <p>
1119
+ <tt>Rails::SecretKeyGenerator</tt> has been replaced by <tt>ActiveSupport::SecureRandom</tt>
1120
+ </p>
1121
+ </li>
1122
+ <li>
1123
+ <p>
1124
+ <tt>render_component</tt> is deprecated. There's a <a href="http://github.com/rails/render_component/tree/master">render_components plugin</a> available if you need this functionality.
1125
+ </p>
1126
+ </li>
1127
+ <li>
1128
+ <p>
1129
+ Implicit local assignments when rendering partials has been deprecated.
1130
+ </p>
1131
+ </li>
1132
+ </ul></div>
1133
+ <div class="listingblock">
1134
+ <div class="content"><!-- Generator: GNU source-highlight 2.9
1135
+ by Lorenzo Bettini
1136
+ http://www.lorenzobettini.it
1137
+ http://www.gnu.org/software/src-highlite -->
1138
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> partial_with_implicit_local_assignment
1139
+ <span style="color: #009900">@customer</span> <span style="color: #990000">=</span> Customer<span style="color: #990000">.</span>new<span style="color: #990000">(</span><span style="color: #FF0000">"Marcel"</span><span style="color: #990000">)</span>
1140
+ render <span style="color: #990000">:</span>partial <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"customer"</span>
1141
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
1142
+ </tt></pre></div></div>
1143
+ <div class="para"><p>Previously the above code made available a local variable called <tt>customer</tt> inside the partial <em>customer</em>. You should explicitly pass all the variables via :locals hash now.</p></div>
1144
+ <div class="ilist"><ul>
1145
+ <li>
1146
+ <p>
1147
+ <tt>country_select</tt> has been removed. See the <a href="http://www.rubyonrails.org/deprecation/list-of-countries">deprecation page</a> for more information and a plugin replacement.
1148
+ </p>
1149
+ </li>
1150
+ <li>
1151
+ <p>
1152
+ <tt>ActiveRecord::Base.allow_concurrency</tt> no longer has any effect.
1153
+ </p>
1154
+ </li>
1155
+ <li>
1156
+ <p>
1157
+ <tt>ActiveRecord::Errors.default_error_messages</tt> has been deprecated in favor of <tt>I18n.translate(<em>activerecord.errors.messages</em>)</tt>
1158
+ </p>
1159
+ </li>
1160
+ <li>
1161
+ <p>
1162
+ The <tt>%s</tt> and <tt>%d</tt> interpolation syntax for internationalization is deprecated.
1163
+ </p>
1164
+ </li>
1165
+ <li>
1166
+ <p>
1167
+ <tt>String#chars</tt> has been deprecated in favor of <tt>String#mb_chars</tt>.
1168
+ </p>
1169
+ </li>
1170
+ <li>
1171
+ <p>
1172
+ Durations of fractional months or fractional years are deprecated. Use Ruby's core <tt>Date</tt> and <tt>Time</tt> class arithmetic instead.
1173
+ </p>
1174
+ </li>
1175
+ </ul></div>
1176
+ </div>
1177
+ <h2 id="_credits">12. Credits</h2>
1178
+ <div class="sectionbody">
1179
+ <div class="para"><p>Release notes compiled by <a href="http://afreshcup.com">Mike Gunderloy</a></p></div>
1180
+ </div>
1181
+
1182
+ </div>
1183
+ </div>
1184
+ </body>
1185
+ </html>