actionpack 3.0.0.beta → 3.0.0.beta2

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

Potentially problematic release.


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

Files changed (118) hide show
  1. data/CHANGELOG +291 -260
  2. data/lib/abstract_controller.rb +5 -2
  3. data/lib/abstract_controller/assigns.rb +21 -0
  4. data/lib/abstract_controller/base.rb +13 -5
  5. data/lib/abstract_controller/collector.rb +2 -0
  6. data/lib/abstract_controller/helpers.rb +4 -14
  7. data/lib/abstract_controller/layouts.rb +50 -99
  8. data/lib/abstract_controller/logger.rb +2 -2
  9. data/lib/abstract_controller/rendering.rb +105 -173
  10. data/lib/abstract_controller/view_paths.rb +69 -0
  11. data/lib/action_controller.rb +1 -2
  12. data/lib/action_controller/base.rb +10 -32
  13. data/lib/action_controller/caching.rb +19 -18
  14. data/lib/action_controller/caching/actions.rb +17 -11
  15. data/lib/action_controller/caching/fragments.rb +5 -17
  16. data/lib/action_controller/caching/pages.rb +24 -24
  17. data/lib/action_controller/caching/sweeping.rb +1 -3
  18. data/lib/action_controller/deprecated.rb +0 -2
  19. data/lib/action_controller/deprecated/base.rb +143 -0
  20. data/lib/action_controller/metal.rb +29 -26
  21. data/lib/action_controller/metal/compatibility.rb +18 -87
  22. data/lib/action_controller/metal/cookies.rb +0 -1
  23. data/lib/action_controller/metal/head.rb +1 -0
  24. data/lib/action_controller/metal/helpers.rb +2 -2
  25. data/lib/action_controller/metal/hide_actions.rb +4 -6
  26. data/lib/action_controller/metal/http_authentication.rb +18 -33
  27. data/lib/action_controller/metal/implicit_render.rb +21 -0
  28. data/lib/action_controller/metal/instrumentation.rb +1 -1
  29. data/lib/action_controller/metal/mime_responds.rb +2 -1
  30. data/lib/action_controller/metal/rack_delegation.rb +3 -8
  31. data/lib/action_controller/metal/redirecting.rb +2 -1
  32. data/lib/action_controller/metal/renderers.rb +4 -2
  33. data/lib/action_controller/metal/rendering.rb +31 -44
  34. data/lib/action_controller/metal/request_forgery_protection.rb +41 -4
  35. data/lib/action_controller/metal/responder.rb +2 -0
  36. data/lib/action_controller/metal/session_management.rb +0 -36
  37. data/lib/action_controller/metal/streaming.rb +20 -47
  38. data/lib/action_controller/metal/testing.rb +0 -1
  39. data/lib/action_controller/metal/url_for.rb +11 -148
  40. data/lib/action_controller/middleware.rb +2 -1
  41. data/lib/action_controller/polymorphic_routes.rb +1 -2
  42. data/lib/action_controller/railtie.rb +63 -10
  43. data/lib/action_controller/railties/{subscriber.rb → log_subscriber.rb} +5 -12
  44. data/lib/action_controller/railties/url_helpers.rb +14 -0
  45. data/lib/action_controller/record_identifier.rb +20 -1
  46. data/lib/action_controller/test_case.rb +123 -12
  47. data/lib/action_dispatch.rb +1 -0
  48. data/lib/action_dispatch/http/cache.rb +20 -3
  49. data/lib/action_dispatch/http/filter_parameters.rb +40 -25
  50. data/lib/action_dispatch/http/mime_negotiation.rb +6 -17
  51. data/lib/action_dispatch/http/mime_type.rb +2 -7
  52. data/lib/action_dispatch/http/request.rb +12 -33
  53. data/lib/action_dispatch/http/response.rb +35 -15
  54. data/lib/action_dispatch/http/upload.rb +2 -0
  55. data/lib/action_dispatch/http/url.rb +5 -32
  56. data/lib/action_dispatch/middleware/callbacks.rb +1 -1
  57. data/lib/action_dispatch/middleware/cookies.rb +4 -3
  58. data/lib/action_dispatch/middleware/params_parser.rb +4 -3
  59. data/lib/action_dispatch/middleware/remote_ip.rb +51 -0
  60. data/lib/action_dispatch/middleware/session/abstract_store.rb +1 -0
  61. data/lib/action_dispatch/middleware/session/cookie_store.rb +6 -8
  62. data/lib/action_dispatch/middleware/show_exceptions.rb +0 -14
  63. data/lib/action_dispatch/middleware/stack.rb +6 -2
  64. data/lib/action_dispatch/railtie.rb +3 -1
  65. data/lib/action_dispatch/routing.rb +2 -0
  66. data/lib/action_dispatch/routing/deprecated_mapper.rb +35 -7
  67. data/lib/action_dispatch/routing/mapper.rb +134 -48
  68. data/lib/action_dispatch/routing/route.rb +2 -2
  69. data/lib/action_dispatch/routing/route_set.rb +217 -158
  70. data/lib/action_dispatch/routing/url_for.rb +139 -0
  71. data/lib/action_dispatch/testing/assertions/response.rb +14 -61
  72. data/lib/action_dispatch/testing/assertions/routing.rb +25 -14
  73. data/lib/action_dispatch/testing/integration.rb +32 -50
  74. data/lib/action_dispatch/testing/performance_test.rb +3 -1
  75. data/lib/action_dispatch/testing/test_process.rb +2 -0
  76. data/lib/action_dispatch/testing/test_request.rb +2 -0
  77. data/lib/action_pack/version.rb +4 -3
  78. data/lib/action_view.rb +11 -6
  79. data/lib/action_view/base.rb +33 -121
  80. data/lib/action_view/context.rb +0 -2
  81. data/lib/action_view/helpers.rb +26 -23
  82. data/lib/action_view/helpers/active_model_helper.rb +28 -18
  83. data/lib/action_view/helpers/asset_tag_helper.rb +109 -54
  84. data/lib/action_view/helpers/atom_feed_helper.rb +2 -2
  85. data/lib/action_view/helpers/cache_helper.rb +22 -1
  86. data/lib/action_view/helpers/capture_helper.rb +22 -22
  87. data/lib/action_view/helpers/date_helper.rb +6 -5
  88. data/lib/action_view/helpers/form_helper.rb +78 -63
  89. data/lib/action_view/helpers/form_options_helper.rb +6 -4
  90. data/lib/action_view/helpers/form_tag_helper.rb +26 -15
  91. data/lib/action_view/helpers/javascript_helper.rb +90 -10
  92. data/lib/action_view/helpers/number_helper.rb +315 -118
  93. data/lib/action_view/helpers/prototype_helper.rb +19 -46
  94. data/lib/action_view/helpers/record_tag_helper.rb +4 -4
  95. data/lib/action_view/helpers/tag_helper.rb +7 -24
  96. data/lib/action_view/helpers/text_helper.rb +8 -7
  97. data/lib/action_view/helpers/translation_helper.rb +7 -5
  98. data/lib/action_view/helpers/url_helper.rb +19 -16
  99. data/lib/action_view/locale/en.yml +45 -6
  100. data/lib/action_view/lookup_context.rb +190 -0
  101. data/lib/action_view/paths.rb +22 -63
  102. data/lib/action_view/railtie.rb +14 -4
  103. data/lib/action_view/railties/{subscriber.rb → log_subscriber.rb} +1 -1
  104. data/lib/action_view/render/layouts.rb +73 -0
  105. data/lib/action_view/render/partials.rb +15 -41
  106. data/lib/action_view/render/rendering.rb +27 -78
  107. data/lib/action_view/template.rb +20 -24
  108. data/lib/action_view/template/error.rb +22 -2
  109. data/lib/action_view/template/handlers/erb.rb +33 -9
  110. data/lib/action_view/template/handlers/rjs.rb +1 -2
  111. data/lib/action_view/template/resolver.rb +46 -104
  112. data/lib/action_view/template/text.rb +5 -12
  113. data/lib/action_view/test_case.rb +14 -23
  114. metadata +83 -40
  115. data/lib/abstract_controller/compatibility.rb +0 -18
  116. data/lib/abstract_controller/localized_cache.rb +0 -49
  117. data/lib/action_controller/metal/configuration.rb +0 -28
  118. data/lib/action_controller/url_rewriter.rb +0 -76
data/CHANGELOG CHANGED
@@ -1,4 +1,35 @@
1
- *Edge*
1
+ *Rails 3.0.0 [beta 2] (April 1st, 2010)*
2
+
3
+ * #concat is now deprecated in favor of using <%= %> helpers [YK]
4
+
5
+ * Block helpers now return Strings, so you can use <%= form_for @foo do |f| %>.
6
+ <% form_for do |f| %> still works with deprecation notices [YK]
7
+
8
+ * Add a new #mount method on the router that does not anchor the PATH_INFO
9
+ at the end [YK & CL]
10
+
11
+ * Create a new LookupContext object that is responsible for performantly
12
+ finding a template for a given pattern [JV]
13
+
14
+ * Removed relative_url_for in favor of respecting SCRIPT_NAME [YK & CL]
15
+
16
+ * Changed file streaming to use Rack::Sendfile middleware [YK]
17
+
18
+ * ActionDispatch::Request#content_type returns a String to be compatible with
19
+ Rack::Request. Use #content_mime_type for the Mime::Type instance [YK]
20
+
21
+ * Updated Prototype to 1.6.1 and Scriptaculous to 1.8.3 [ML]
22
+
23
+ * Change the preferred way that URL helpers are included into a class[YK & CL]
24
+
25
+ # for all helpers including named routes
26
+ include Rails.application.router.url_helpers
27
+
28
+ # for just url_for
29
+ include Rails.application.router.url_for
30
+
31
+
32
+ *Rails 3.0.0 [beta 1] (February 4, 2010)*
2
33
 
3
34
  * Fixed that PrototypeHelper#update_page should return html_safe [DHH]
4
35
 
@@ -14,9 +45,9 @@
14
45
 
15
46
  flash[:notice] = 'Post was created'
16
47
  redirect_to(@post)
17
-
48
+
18
49
  ...becomes:
19
-
50
+
20
51
  redirect_to(@post, :notice => 'Post was created')
21
52
 
22
53
  * Added ActionController::Base#notice/= and ActionController::Base#alert/= as a convenience accessors in both the controller and the view for flash[:notice]/= and flash[:alert]/= [DHH]
@@ -147,14 +178,14 @@
147
178
 
148
179
  # Instead of <%= render :partial => "account" %>
149
180
  <%= render "account" %>
150
-
181
+
151
182
  # Instead of <%= render :partial => "account", :locals => { :account => @buyer } %>
152
183
  <%= render "account", :account => @buyer %>
153
-
184
+
154
185
  # @account is an Account instance, so it uses the RecordIdentifier to replace
155
186
  # <%= render :partial => "accounts/account", :locals => { :account => @account } %>
156
187
  <%= render(@account) %>
157
-
188
+
158
189
  # @posts is an array of Post instances, so it uses the RecordIdentifier to replace
159
190
  # <%= render :partial => "posts/post", :collection => @posts %>
160
191
  <%= render(@posts) %>
@@ -245,7 +276,7 @@
245
276
 
246
277
  * Make PrototypeHelper#submit_to_remote a wrapper around PrototypeHelper#button_to_remote. [Tarmo Tänav]
247
278
 
248
- * Set HttpOnly for the cookie session store's cookie. #1046
279
+ * Set HttpOnly for the cookie session store's cookie. #1046
249
280
 
250
281
  * Added FormTagHelper#image_submit_tag confirm option #784 [Alastair Brunton]
251
282
 
@@ -262,7 +293,7 @@
262
293
  Completed in 0.10000 (4 reqs/sec) | Rendering: 0.04000 (40%) | DB: 0.00400 (4%) | 200 OK [http://example.com]
263
294
 
264
295
  ...to:
265
-
296
+
266
297
  Completed in 100ms (View: 40, DB: 4) | 200 OK [http://example.com]
267
298
 
268
299
  * Add support for shallow nesting of routes. #838 [S. Brent Faulkner]
@@ -347,7 +378,7 @@
347
378
  * Deprecated TemplateHandler line offset [Josh Peek]
348
379
 
349
380
  * Allow caches_action to accept cache store options. #416. [José Valim]. Example:
350
-
381
+
351
382
  caches_action :index, :redirected, :if => Proc.new { |c| !c.request.format.json? }, :expires_in => 1.hour
352
383
 
353
384
  * Remove define_javascript_functions, javascript_include_tag and friends are far superior. [Michael Koziarski]
@@ -357,7 +388,7 @@
357
388
  * Add :as option to render a collection of partials with a custom local variable name. #509 [Simon Jefford, Pratik Naik]
358
389
 
359
390
  render :partial => 'other_people', :collection => @people, :as => :person
360
-
391
+
361
392
  This will let you access objects of @people as 'person' local variable inside 'other_people' partial template.
362
393
 
363
394
  * time_zone_select: support for regexp matching of priority zones. Resolves #195 [Ernie Miller]
@@ -511,7 +542,7 @@
511
542
 
512
543
  * Remove support for multivalued (e.g., '&'-delimited) cookies. [Jamis Buck]
513
544
 
514
- * Fix problem with render :partial collections, records, and locals. #11057 [lotswholetime]
545
+ * Fix problem with render :partial collections, records, and locals. #11057 [lotswholetime]
515
546
 
516
547
  * Added support for naming concrete classes in sweeper declarations [David Heinemeier Hansson]
517
548
 
@@ -534,7 +565,7 @@
534
565
  * Make assert_routing aware of the HTTP method used. #8039 [mpalmer]
535
566
  e.g. assert_routing({ :method => 'put', :path => '/product/321' }, { :controller => "product", :action => "update", :id => "321" })
536
567
 
537
- * Make map.root accept a single symbol as an argument to declare an alias. #10818 [bscofield]
568
+ * Make map.root accept a single symbol as an argument to declare an alias. #10818 [bscofield]
538
569
 
539
570
  e.g. map.dashboard '/dashboard', :controller=>'dashboard'
540
571
  map.root :dashboard
@@ -543,7 +574,7 @@
543
574
 
544
575
  * Add label_tag helper for generating elements. #10802 [DefV]
545
576
 
546
- * Introduce TemplateFinder to handle view paths and lookups. #10800 [Pratik Naik]
577
+ * Introduce TemplateFinder to handle view paths and lookups. #10800 [Pratik Naik]
547
578
 
548
579
  * Performance: optimize route recognition. Large speedup for apps with many resource routes. #10835 [oleganza]
549
580
 
@@ -768,7 +799,7 @@
768
799
 
769
800
  * ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick Olson]
770
801
 
771
- * Only accept session ids from cookies, prevents session fixation attacks. [bradediger]
802
+ * Only accept session ids from cookies, prevents session fixation attacks. [bradediger]
772
803
 
773
804
 
774
805
  *2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.12.2 - 1.13.3]
@@ -827,7 +858,7 @@
827
858
 
828
859
  def index
829
860
  @posts = Post.find(:all)
830
-
861
+
831
862
  respond_to do |format|
832
863
  format.html # => renders index.html.erb and uses "text/html" as the content type
833
864
  format.iphone # => renders index.iphone.erb and uses "text/html" as the content type
@@ -921,7 +952,7 @@
921
952
 
922
953
  After filters will *no longer* be run if an around_filter fails to yield, users relying on
923
954
  this behaviour are advised to put the code in question after a yield statement in an around filter.
924
-
955
+
925
956
 
926
957
  * Allow you to delete cookies with options. Closes #3685 [Josh Peek, Chris Wanstrath]
927
958
 
@@ -1021,13 +1052,13 @@
1021
1052
 
1022
1053
  * Update to Prototype 1.5.1. [Sam Stephenson]
1023
1054
 
1024
- * Allow routes to be decalred under namespaces [Tobias Lütke]:
1025
-
1055
+ * Allow routes to be decalred under namespaces [Tobias Lütke]:
1056
+
1026
1057
  map.namespace :admin do |admin|
1027
- admin.root :controller => "products"
1058
+ admin.root :controller => "products"
1028
1059
  admin.feed 'feed.xml', :controller => 'products', :action => 'feed', :format => 'xml'
1029
1060
  end
1030
-
1061
+
1031
1062
  * Update to script.aculo.us 1.7.1_beta3. [Thomas Fuchs]
1032
1063
 
1033
1064
  * observe_form always sends the serialized form. #5271 [Manfred Stienstra, normelton@gmail.com]
@@ -1039,7 +1070,7 @@
1039
1070
  * Added url_for usage on render :location, which allows for record identification [David Heinemeier Hansson]. Example:
1040
1071
 
1041
1072
  render :xml => person, :status => :created, :location => person
1042
-
1073
+
1043
1074
  ...expands the location to person_url(person).
1044
1075
 
1045
1076
  * Introduce the request.body stream. Lazy-read to parse parameters rather than always setting RAW_POST_DATA. Reduces the memory footprint of large binary PUT requests. [Jeremy Kemper]
@@ -1067,21 +1098,21 @@
1067
1098
  <% form_for(@post) do |f| %>
1068
1099
  ...
1069
1100
  <% end %>
1070
-
1101
+
1071
1102
  This will expand to be the same as:
1072
-
1103
+
1073
1104
  <% form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %>
1074
1105
  ...
1075
1106
  <% end %>
1076
-
1107
+
1077
1108
  And for new records:
1078
-
1109
+
1079
1110
  <% form_for(Post.new) do |f| %>
1080
1111
  ...
1081
1112
  <% end %>
1082
-
1113
+
1083
1114
  This will expand to be the same as:
1084
-
1115
+
1085
1116
  <% form_for :post, @post, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
1086
1117
  ...
1087
1118
  <% end %>
@@ -1093,7 +1124,7 @@
1093
1124
  redirect_to(post) # => redirect_to(posts_url(post)) => Location: http://example.com/posts/1
1094
1125
  link_to(post.title, post) # => link_to(post.title, posts_url(post)) => <a href="/posts/1">Hello world</a>
1095
1126
 
1096
- Any method that calls url_for on its parameters will automatically benefit from this.
1127
+ Any method that calls url_for on its parameters will automatically benefit from this.
1097
1128
 
1098
1129
  * Removed deprecated parameters_for_method_reference concept (legacy from before named routes) [David Heinemeier Hansson]
1099
1130
 
@@ -1137,14 +1168,14 @@
1137
1168
  * Added map.namespace to deal with the common situation of admin sections and the like [David Heinemeier Hansson]
1138
1169
 
1139
1170
  Before:
1140
-
1171
+
1141
1172
  map.resources :products, :path_prefix => "admin", :controller => "admin/products", :collection => { :inventory => :get }, :member => { :duplicate => :post }
1142
1173
  map.resources :tags, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_tags"
1143
1174
  map.resources :images, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_images"
1144
1175
  map.resources :variants, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_variants"
1145
1176
 
1146
1177
  After:
1147
-
1178
+
1148
1179
  map.namespace(:admin) do |admin|
1149
1180
  admin.resources :products,
1150
1181
  :collection => { :inventory => :get },
@@ -1160,28 +1191,28 @@
1160
1191
  emails.resources :comments, :name_prefix => "email_"
1161
1192
  emails.resources :attachments, :name_prefix => "email_"
1162
1193
  end
1163
-
1194
+
1164
1195
  After:
1165
1196
 
1166
1197
  map.resources :emails do |emails|
1167
1198
  emails.resources :comments
1168
1199
  emails.resources :attachments
1169
1200
  end
1170
-
1201
+
1171
1202
  This does mean that if you intended to have comments_url go to /emails/5/comments, then you'll have to set :name_prefix to nil explicitly.
1172
1203
 
1173
1204
  * Added :has_many and :has_one for declaring plural and singular resources beneath the current [David Heinemeier Hansson]
1174
1205
 
1175
1206
  Before:
1176
-
1207
+
1177
1208
  map.resources :notes do |notes|
1178
1209
  notes.resources :comments
1179
1210
  notes.resources :attachments
1180
1211
  notes.resource :author
1181
1212
  end
1182
-
1213
+
1183
1214
  After:
1184
-
1215
+
1185
1216
  map.resources :notes, :has_many => [ :comments, :attachments ], :has_one => :author
1186
1217
 
1187
1218
  * Added that render :xml will try to call to_xml if it can [David Heinemeier Hansson]. Makes these work:
@@ -1209,9 +1240,9 @@
1209
1240
 
1210
1241
  * Default xml template goes from #{action_name}.rxml => #{action_name}.xml.builder.
1211
1242
  * Default rjs template goes from #{action_name}.rjs => #{action_name}.js.rjs.
1212
-
1243
+
1213
1244
  You can still specify your old templates:
1214
-
1245
+
1215
1246
  respond_to do |format|
1216
1247
  format.xml do
1217
1248
  render :action => "#{action_name}.rxml"
@@ -1239,8 +1270,8 @@
1239
1270
  * Allow configuration of the default action cache path for #caches_action calls. [Rick Olson]
1240
1271
 
1241
1272
  class ListsController < ApplicationController
1242
- caches_action :index, :cache_path => Proc.new { |controller|
1243
- controller.params[:user_id] ?
1273
+ caches_action :index, :cache_path => Proc.new { |controller|
1274
+ controller.params[:user_id] ?
1244
1275
  controller.send(:user_lists_url, c.params[:user_id]) :
1245
1276
  controller.send(:lists_url) }
1246
1277
  end
@@ -1313,7 +1344,7 @@ Roos]
1313
1344
  <link href="/stylesheets/style1.css" media="screen" rel="Stylesheet" type="text/css" />
1314
1345
  <link href="/stylesheets/styleB.css" media="screen" rel="Stylesheet" type="text/css" />
1315
1346
  <link href="/stylesheets/styleX2.css" media="screen" rel="Stylesheet" type="text/css" />
1316
-
1347
+
1317
1348
  stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
1318
1349
  <link href="/stylesheets/all.css" media="screen" rel="Stylesheet" type="text/css" />
1319
1350
 
@@ -1469,7 +1500,7 @@ superclass' view_paths. [Rick Olson]
1469
1500
  * Add singleton resources. [Rick Olson]
1470
1501
 
1471
1502
  map.resource :account
1472
-
1503
+
1473
1504
  GET /account
1474
1505
  GET /account;edit
1475
1506
  UPDATE /account
@@ -1508,7 +1539,7 @@ superclass' view_paths. [Rick Olson]
1508
1539
  * Added the option for extension aliases to mime type registration [David Heinemeier Hansson]. Example (already in the default routes):
1509
1540
 
1510
1541
  Mime::Type.register "text/html", :html, %w( application/xhtml+xml ), %w( xhtml )
1511
-
1542
+
1512
1543
  ...will respond on both .html and .xhtml.
1513
1544
 
1514
1545
  * @response.redirect_url works with 201 Created responses: just return headers['Location'] rather than checking the response status. [Jeremy Kemper]
@@ -1577,7 +1608,7 @@ superclass' view_paths. [Rick Olson]
1577
1608
  <% content_tag :div, :class => "strong" %>
1578
1609
  Hello world!
1579
1610
  <% end %>
1580
-
1611
+
1581
1612
  Will output:
1582
1613
  <div class="strong">Hello world!</div>
1583
1614
 
@@ -1636,7 +1667,7 @@ superclass' view_paths. [Rick Olson]
1636
1667
  Gives:
1637
1668
 
1638
1669
  <script defer="true" type="text/javascript">...</script>
1639
-
1670
+
1640
1671
  Which is needed for dealing with the IE6 DOM when it's not yet fully loaded.
1641
1672
 
1642
1673
  * Fixed that rescue template path shouldn't be hardcoded, then it's easier to hook in your own #6295 [Mike Naberezny]
@@ -1693,9 +1724,9 @@ superclass' view_paths. [Rick Olson]
1693
1724
  * Added proper getters and setters for content type and charset [David Heinemeier Hansson]. Example of what we used to do:
1694
1725
 
1695
1726
  response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
1696
-
1727
+
1697
1728
  ...now:
1698
-
1729
+
1699
1730
  response.content_type = Mime::ATOM
1700
1731
  response.charset = "utf-8"
1701
1732
 
@@ -1738,7 +1769,7 @@ superclass' view_paths. [Rick Olson]
1738
1769
  * Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [David Heinemeier Hansson]. So what used to require a nil, like this:
1739
1770
 
1740
1771
  link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
1741
-
1772
+
1742
1773
  ...can be written like this:
1743
1774
 
1744
1775
  link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
@@ -1756,7 +1787,7 @@ superclass' view_paths. [Rick Olson]
1756
1787
 
1757
1788
  * Fixed that AssetTagHelper#image_tag and others using compute_public_path should not modify the incoming source argument (closes #5102) [eule@space.ch]
1758
1789
 
1759
- * Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [David Heinemeier Hansson]
1790
+ * Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [David Heinemeier Hansson]
1760
1791
 
1761
1792
  * Fixed FormOptionsHelper#select to respect :selected value #5813
1762
1793
 
@@ -1953,7 +1984,7 @@ superclass' view_paths. [Rick Olson]
1953
1984
  class WeblogController < ActionController::Base
1954
1985
  def index
1955
1986
  @posts = Post.find :all
1956
-
1987
+
1957
1988
  respond_to do |format|
1958
1989
  format.html
1959
1990
  format.xml { render :xml => @posts.to_xml }
@@ -1961,26 +1992,26 @@ superclass' view_paths. [Rick Olson]
1961
1992
  end
1962
1993
  end
1963
1994
  end
1964
-
1995
+
1965
1996
  # returns HTML when requested by a browser, since the browser
1966
1997
  # has the HTML mimetype at the top of its priority list
1967
1998
  Accept: text/html
1968
- GET /weblog
1969
-
1970
- # returns the XML
1999
+ GET /weblog
2000
+
2001
+ # returns the XML
1971
2002
  Accept: application/xml
1972
- GET /weblog
2003
+ GET /weblog
1973
2004
 
1974
- # returns the HTML
2005
+ # returns the HTML
1975
2006
  Accept: application/xml
1976
2007
  GET /weblog.html
1977
2008
 
1978
2009
  # returns the XML
1979
2010
  Accept: text/html
1980
2011
  GET /weblog.xml
1981
-
2012
+
1982
2013
  All this relies on the fact that you have a route that includes .:format.
1983
-
2014
+
1984
2015
  * Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [David Heinemeier Hansson]
1985
2016
 
1986
2017
  * Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [David Heinemeier Hansson]
@@ -2016,12 +2047,12 @@ superclass' view_paths. [Rick Olson]
2016
2047
  * Fixes bad rendering of JavaScriptMacrosHelper rdoc (closes #4910) [Frederick Ros]
2017
2048
 
2018
2049
  * Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]
2019
-
2050
+
2020
2051
  error_messages_for :account, :user, :subscription, :object_name => :account
2021
2052
 
2022
2053
  * Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there. Closes #4079. [Rick Olson]
2023
2054
 
2024
- * Documentation for AbstractRequest. Closes #4895. [Kevin Clark]
2055
+ * Documentation for AbstractRequest. Closes #4895. [Kevin Clark]
2025
2056
 
2026
2057
  * Refactor various InstanceTag instance method to class methods. Closes #4800. [Stefan Kaes]
2027
2058
 
@@ -2054,8 +2085,8 @@ superclass' view_paths. [Rick Olson]
2054
2085
  * Modify routing so that you can say :require => { :method => :post } for a route, and the route will never be selected unless the request method is POST. Only works for route recognition, not for route generation. [Jamis Buck]
2055
2086
 
2056
2087
  * Added :add_headers option to verify which merges a hash of name/value pairs into the response's headers hash if the prerequisites cannot be satisfied. [Sam Stephenson]
2057
- ex. verify :only => :speak, :method => :post,
2058
- :render => { :status => 405, :text => "Must be post" },
2088
+ ex. verify :only => :speak, :method => :post,
2089
+ :render => { :status => 405, :text => "Must be post" },
2059
2090
  :add_headers => { "Allow" => "POST" }
2060
2091
 
2061
2092
  * Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled #1897 [jeremye@bsa.ca.gov]
@@ -2221,7 +2252,7 @@ superclass' view_paths. [Rick Olson]
2221
2252
  <% content_tag :div, :class => "strong" %>
2222
2253
  Hello world!
2223
2254
  <% end %>
2224
-
2255
+
2225
2256
  Will output:
2226
2257
  <div class="strong">Hello world!</div>
2227
2258
 
@@ -2274,7 +2305,7 @@ superclass' view_paths. [Rick Olson]
2274
2305
  Gives:
2275
2306
 
2276
2307
  <script defer="true" type="text/javascript">...</script>
2277
-
2308
+
2278
2309
  Which is needed for dealing with the IE6 DOM when it's not yet fully loaded.
2279
2310
 
2280
2311
  * Fixed that rescue template path shouldn't be hardcoded, then it's easier to hook in your own #6295 [Mike Naberezny]
@@ -2329,9 +2360,9 @@ superclass' view_paths. [Rick Olson]
2329
2360
  * Added proper getters and setters for content type and charset [David Heinemeier Hansson]. Example of what we used to do:
2330
2361
 
2331
2362
  response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
2332
-
2363
+
2333
2364
  ...now:
2334
-
2365
+
2335
2366
  response.content_type = Mime::ATOM
2336
2367
  response.charset = "utf-8"
2337
2368
 
@@ -2366,7 +2397,7 @@ superclass' view_paths. [Rick Olson]
2366
2397
  * Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [David Heinemeier Hansson]. So what used to require a nil, like this:
2367
2398
 
2368
2399
  link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
2369
-
2400
+
2370
2401
  ...can be written like this:
2371
2402
 
2372
2403
  link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
@@ -2380,7 +2411,7 @@ superclass' view_paths. [Rick Olson]
2380
2411
 
2381
2412
  * Fixed that AssetTagHelper#image_tag and others using compute_public_path should not modify the incoming source argument (closes #5102) [eule@space.ch]
2382
2413
 
2383
- * Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [David Heinemeier Hansson]
2414
+ * Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [David Heinemeier Hansson]
2384
2415
 
2385
2416
  * Fixed FormOptionsHelper#select to respect :selected value #5813
2386
2417
 
@@ -2546,7 +2577,7 @@ superclass' view_paths. [Rick Olson]
2546
2577
  class WeblogController < ActionController::Base
2547
2578
  def index
2548
2579
  @posts = Post.find :all
2549
-
2580
+
2550
2581
  respond_to do |format|
2551
2582
  format.html
2552
2583
  format.xml { render :xml => @posts.to_xml }
@@ -2554,26 +2585,26 @@ superclass' view_paths. [Rick Olson]
2554
2585
  end
2555
2586
  end
2556
2587
  end
2557
-
2588
+
2558
2589
  # returns HTML when requested by a browser, since the browser
2559
2590
  # has the HTML mimetype at the top of its priority list
2560
2591
  Accept: text/html
2561
- GET /weblog
2562
-
2563
- # returns the XML
2592
+ GET /weblog
2593
+
2594
+ # returns the XML
2564
2595
  Accept: application/xml
2565
- GET /weblog
2596
+ GET /weblog
2566
2597
 
2567
- # returns the HTML
2598
+ # returns the HTML
2568
2599
  Accept: application/xml
2569
2600
  GET /weblog.html
2570
2601
 
2571
2602
  # returns the XML
2572
2603
  Accept: text/html
2573
2604
  GET /weblog.xml
2574
-
2605
+
2575
2606
  All this relies on the fact that you have a route that includes .:format.
2576
-
2607
+
2577
2608
  * Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [David Heinemeier Hansson]
2578
2609
 
2579
2610
  * Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [David Heinemeier Hansson]
@@ -2595,7 +2626,7 @@ superclass' view_paths. [Rick Olson]
2595
2626
  * Use #flush between switching from #write to #syswrite. Closes #4907. [Blair Zajac <blair@orcaware.com>]
2596
2627
 
2597
2628
  * Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]
2598
-
2629
+
2599
2630
  error_messages_for :account, :user, :subscription, :object_name => :account
2600
2631
 
2601
2632
  * Fix assert_redirected_to tests according to real-world usage. Also, don't fail if you add an extra :controller option: [Rick Olson]
@@ -2617,8 +2648,8 @@ superclass' view_paths. [Rick Olson]
2617
2648
  * Modify routing so that you can say :require => { :method => :post } for a route, and the route will never be selected unless the request method is POST. Only works for route recognition, not for route generation. [Jamis Buck]
2618
2649
 
2619
2650
  * Added :add_headers option to verify which merges a hash of name/value pairs into the response's headers hash if the prerequisites cannot be satisfied. [Sam Stephenson]
2620
- ex. verify :only => :speak, :method => :post,
2621
- :render => { :status => 405, :text => "Must be post" },
2651
+ ex. verify :only => :speak, :method => :post,
2652
+ :render => { :status => 405, :text => "Must be post" },
2622
2653
  :add_headers => { "Allow" => "POST" }
2623
2654
 
2624
2655
 
@@ -2683,7 +2714,7 @@ superclass' view_paths. [Rick Olson]
2683
2714
  * Added automated timestamping to AssetTagHelper methods for stylesheets, javascripts, and images when Action Controller is run under Rails [David Heinemeier Hansson]. Example:
2684
2715
 
2685
2716
  image_tag("rails.png") # => '<img alt="Rails" src="/images/rails.png?1143664135" />'
2686
-
2717
+
2687
2718
  ...to avoid frequent stats (not a problem for most people), you can set RAILS_ASSET_ID in the ENV to avoid stats:
2688
2719
 
2689
2720
  ENV["RAILS_ASSET_ID"] = "2345"
@@ -2703,9 +2734,9 @@ superclass' view_paths. [Rick Olson]
2703
2734
  * Change #form_for and #fields_for so that the second argument is not required [Dave Thomas]
2704
2735
 
2705
2736
  <% form_for :post, @post, :url => { :action => 'create' } do |f| -%>
2706
-
2737
+
2707
2738
  becomes...
2708
-
2739
+
2709
2740
  <% form_for :post, :url => { :action => 'create' } do |f| -%>
2710
2741
 
2711
2742
  * Update to script.aculo.us 1.6 [Thomas Fuchs]
@@ -2723,11 +2754,11 @@ superclass' view_paths. [Rick Olson]
2723
2754
  * Added nicer message for assert_redirected_to (closes #4294) [court3nay]
2724
2755
 
2725
2756
  assert_redirected_to :action => 'other_host', :only_path => false
2726
-
2757
+
2727
2758
  when it was expecting...
2728
-
2759
+
2729
2760
  redirected_to :action => 'other_host', :only_path => true, :host => 'other.test.host'
2730
-
2761
+
2731
2762
  gives the error message...
2732
2763
 
2733
2764
  response is not a redirection to all of the options supplied (redirection is <{:only_path=>false, :host=>"other.test.host", :action=>"other_host"}>), difference: <{:only_path=>"true", :host=>"other.test.host"}>
@@ -2774,11 +2805,11 @@ superclass' view_paths. [Rick Olson]
2774
2805
  * CHANGED DEFAULT: The default content type for .rxml is now application/xml instead of type/xml, see http://www.xml.com/pub/a/2004/07/21/dive.html for reason [David Heinemeier Hansson]
2775
2806
 
2776
2807
  * Added option to render action/template/file of a specific extension (and here by template type). This means you can have multiple templates with the same name but a different extension [David Heinemeier Hansson]. Example:
2777
-
2808
+
2778
2809
  class WeblogController < ActionController::Base
2779
2810
  def index
2780
2811
  @posts = Post.find :all
2781
-
2812
+
2782
2813
  respond_to do |type|
2783
2814
  type.html # using defaults, which will render weblog/index.rhtml
2784
2815
  type.xml { render :action => "index.rxml" }
@@ -2792,7 +2823,7 @@ superclass' view_paths. [Rick Olson]
2792
2823
  class WeblogController < ActionController::Base
2793
2824
  def create
2794
2825
  @post = Post.create(params[:post])
2795
-
2826
+
2796
2827
  respond_to do |type|
2797
2828
  type.js { render } # renders create.rjs
2798
2829
  type.html { redirect_to :action => "index" }
@@ -2818,16 +2849,16 @@ superclass' view_paths. [Rick Olson]
2818
2849
  * Added plugin support for parameter parsers, which allows for better support for REST web services. By default, posts submitted with the application/xml content type is handled by creating a XmlSimple hash with the same name as the root element of the submitted xml. More handlers can easily be registered like this:
2819
2850
 
2820
2851
  # Assign a new param parser to a new content type
2821
- ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data|
2822
- node = REXML::Document.new(post)
2852
+ ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data|
2853
+ node = REXML::Document.new(post)
2823
2854
  { node.root.name => node.root }
2824
2855
  end
2825
2856
 
2826
2857
  # Assign the default XmlSimple to a new content type
2827
2858
  ActionController::Base.param_parsers['application/backpack+xml'] = :xml_simple
2828
-
2859
+
2829
2860
  Default YAML web services were retired, ActionController::Base.param_parsers carries an example which shows how to get this functionality back. As part of this new plugin support, request.[formatted_post?, xml_post?, yaml_post? and post_format] were all deprecated in favor of request.content_type [Tobias Lütke]
2830
-
2861
+
2831
2862
  * Fixed Effect.Appear in effects.js to work with floats in Safari #3524, #3813, #3044 [Thomas Fuchs]
2832
2863
 
2833
2864
  * Fixed that default image extension was not appended when using a full URL with AssetTagHelper#image_tag #4032, #3728 [rubyonrails@beautifulpixel.com]
@@ -2865,7 +2896,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
2865
2896
  page['blank_slate'] # => $('blank_slate');
2866
2897
  page['blank_slate'].show # => $('blank_slate').show();
2867
2898
  page['blank_slate'].show('first').up # => $('blank_slate').show('first').up();
2868
-
2899
+
2869
2900
  page.select('p') # => $$('p');
2870
2901
  page.select('p.welcome b').first # => $$('p.welcome b').first();
2871
2902
  page.select('p.welcome b').first.hide # => $$('p.welcome b').first().hide();
@@ -3003,7 +3034,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3003
3034
  * Add session ID to default logging, but remove the verbose description of every step [David Heinemeier Hansson]
3004
3035
 
3005
3036
  * Add the following RJS methods: [Sam Stephenson]
3006
-
3037
+
3007
3038
  * alert - Displays an alert() dialog
3008
3039
  * redirect_to - Changes window.location.href to simulate a browser redirect
3009
3040
  * call - Calls a JavaScript function
@@ -3085,13 +3116,13 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3085
3116
  page.visual_effect :highlight, 'list'
3086
3117
  page.hide 'status-indicator', 'cancel-link'
3087
3118
  end
3088
-
3119
+
3089
3120
  generates the following JavaScript:
3090
-
3121
+
3091
3122
  new Insertion.Bottom("list", "<li>Last item</li>");
3092
3123
  new Effect.Highlight("list");
3093
3124
  ["status-indicator", "cancel-link"].each(Element.hide);
3094
-
3125
+
3095
3126
  * Refactored JavaScriptHelper into PrototypeHelper and ScriptaculousHelper [Sam Stephenson]
3096
3127
 
3097
3128
  * Update to latest script.aculo.us version (as of [3031])
@@ -3114,12 +3145,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3114
3145
  <% form_for :person, person, :url => { :action => "update" } do |person_form| %>
3115
3146
  First name: <%= person_form.text_field :first_name %>
3116
3147
  Last name : <%= person_form.text_field :last_name %>
3117
-
3148
+
3118
3149
  <% fields_for :permission => person.permission do |permission_fields| %>
3119
3150
  Admin? : <%= permission_fields.check_box :admin %>
3120
3151
  <% end %>
3121
3152
  <% end %>
3122
-
3153
+
3123
3154
  * options_for_select allows any objects which respond_to? :first and :last rather than restricting to Array and Range. #2824 [Jacob Robbins <jrobbins@cmj.com>, Jeremy Kemper]
3124
3155
 
3125
3156
  * The auto_link text helper accepts an optional block to format the link text for each url and email address. Example: auto_link(post.body) { |text| truncate(text, 10) } [Jeremy Kemper]
@@ -3150,11 +3181,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3150
3181
  class ApplicationController < ActionController::Base
3151
3182
  before_filter :authenticate
3152
3183
  end
3153
-
3184
+
3154
3185
  class WeblogController < ApplicationController
3155
3186
  # will run the :authenticate filter
3156
3187
  end
3157
-
3188
+
3158
3189
  class SignupController < ActionController::Base
3159
3190
  # will not run the :authenticate filter
3160
3191
  skip_before_filter :authenticate
@@ -3300,7 +3331,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3300
3331
  * Added easy assignment of fragment cache store through use of symbols for included stores (old way still works too)
3301
3332
 
3302
3333
  Before:
3303
- ActionController::Base.fragment_cache_store =
3334
+ ActionController::Base.fragment_cache_store =
3304
3335
  ActionController::Base::Caching::Fragments::FileStore.new("/path/to/cache/directory")
3305
3336
 
3306
3337
  After:
@@ -3463,7 +3494,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3463
3494
  * Added incremental and local autocompleting and loads of documentation to controls.js [Ivan Krstic]
3464
3495
  * Extended the auto_complete_field helper to accept tokens option
3465
3496
  * Changed object extension mechanism to favor Object.extend to make script.aculo.us easily adaptable to support 3rd party libs like IE7.js [David Zülke]
3466
-
3497
+
3467
3498
  * Fixed that named routes didn't use the default values for action and possible other parameters #1534 [Nicholas Seckar]
3468
3499
 
3469
3500
  * Fixed JavascriptHelper#visual_effect to use camelize such that :blind_up will work #1639 [pelletierm@eastmedia.net]
@@ -3519,13 +3550,13 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3519
3550
  * Added support for graceful error handling of Ajax calls #1217 [Jamis Buck/Thomas Fuchs]. Example:
3520
3551
 
3521
3552
  link_to_remote(
3522
- "test",
3523
- :url => { :action => "faulty" },
3553
+ "test",
3554
+ :url => { :action => "faulty" },
3524
3555
  :update => { :success => "good", :failure => "bad" },
3525
3556
  403 => "alert('Forbidden- got ya!')",
3526
- 404 => "alert('Nothing there...?')",
3557
+ 404 => "alert('Nothing there...?')",
3527
3558
  :failure => "alert('Unkown error ' + request.status)")
3528
-
3559
+
3529
3560
  * Attempt to explicitly flush the output at the end of CgiProcess#out
3530
3561
 
3531
3562
  * Fixed assert_redirected_to to handle absolute controller paths properly #1472 [Rick Olson/Nicholas Seckar]
@@ -3536,7 +3567,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3536
3567
 
3537
3568
  * Fixed prototype to consider all fields it doesn't know as text (such as Safari's search) just like the browser in its serialization #1497 [Sean Treadway]
3538
3569
 
3539
- * Improved performance of Routes generation by a factor of 5 #1434 [Nicholas Seckar]
3570
+ * Improved performance of Routes generation by a factor of 5 #1434 [Nicholas Seckar]
3540
3571
 
3541
3572
  * Added named routes (NEEDS BETTER DESCRIPTION) #1434 [Nicholas Seckar]
3542
3573
 
@@ -3567,8 +3598,8 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3567
3598
 
3568
3599
  * Correct distance_of_time_in_words for integer arguments and make the second arg optional, treating the first arg as a duration in seconds. #1458 [madrobby <thomas@fesch.at>]
3569
3600
 
3570
- * Fixed query parser to deal gracefully with equal signs inside keys and values #1345 [gorou].
3571
- Example: /?sig=abcdef=:foobar=&x=y will pass now.
3601
+ * Fixed query parser to deal gracefully with equal signs inside keys and values #1345 [gorou].
3602
+ Example: /?sig=abcdef=:foobar=&x=y will pass now.
3572
3603
 
3573
3604
  * Added Cuba to country list #1351 [todd]
3574
3605
 
@@ -3588,7 +3619,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3588
3619
 
3589
3620
  * Ensure that helpers are only available to the controllers where they are defined and their subclasses. #1394 [kdole@tamu.edu]
3590
3621
 
3591
- * render("foo/bar") works with a layout again
3622
+ * render("foo/bar") works with a layout again
3592
3623
 
3593
3624
  * Fixed double-singularization on scaffolded pagination call (Address would be turned into Addres) #1216, #1404 [nilsga]
3594
3625
 
@@ -3636,7 +3667,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3636
3667
  | render_text "hello world!" | render :text => "hello world!" |
3637
3668
  | render_partial_collection "person", @people, nil, :a => 1 | render :partial => "person", :collection => @people, |
3638
3669
  | | :locals => { :a => 1 } |
3639
- +---------------------------------------------------------------+-------------------------------------------------------+
3670
+ +---------------------------------------------------------------+-------------------------------------------------------+
3640
3671
 
3641
3672
  * Deprecated redirect_to_path and redirect_to_url in favor of letting redirect_to do the right thing when passed either a path or url.
3642
3673
 
@@ -3664,7 +3695,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3664
3695
 
3665
3696
  Content-Type: application/xml
3666
3697
  <request><item><content>HelloWorld</content></item></request>
3667
-
3698
+
3668
3699
  ...is the same as:
3669
3700
 
3670
3701
  Content-Type: application/x-yaml
@@ -3673,11 +3704,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3673
3704
  content: HelloWorld
3674
3705
 
3675
3706
  ...is the same as:
3676
-
3707
+
3677
3708
  item[content]=HelloWorld
3678
-
3709
+
3679
3710
  Which in the end turns into { "item" => { "content" => "HelloWorld" } }. This makes it a lot easier to publish REST web services on top of your regular actions (as they won't care).
3680
-
3711
+
3681
3712
  Example Curl call:
3682
3713
 
3683
3714
  curl -H 'Content-Type: application/xml' -d '<request><item><content>KillMeMore</content></item></request>' http://www.example.com/service
@@ -3721,11 +3752,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3721
3752
  * Removed dumping of template assigns on the rescue page as it would very easily include a ton of data making page loads take seconds (and the information was rarely helpful) #1222
3722
3753
 
3723
3754
  * Added BenchmarkHelper that can measure the execution time of a block in a template and reports the result to the log. Example:
3724
-
3755
+
3725
3756
  <% benchmark "Notes section" do %>
3726
3757
  <%= expensive_notes_operation %>
3727
3758
  <% end %>
3728
-
3759
+
3729
3760
  Will add something like "Notes section (0.345234)" to the log.
3730
3761
 
3731
3762
  * Added ActionController::Caching::Sweeper as an improved an easier to use sweeper. The new sweepers work on a single-step approach instead of two-steps like the old ones. Before
@@ -3733,7 +3764,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3733
3764
  def after_save(record)
3734
3765
  @list = record.is_a?(List) ? record : record.list
3735
3766
  end
3736
-
3767
+
3737
3768
  def filter(controller)
3738
3769
  controller.expire_page(:controller => "lists", :action => %w( show public feed ), :id => @list.id)
3739
3770
  controller.expire_action(:controller => "lists", :action => "all")
@@ -3750,7 +3781,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3750
3781
  end
3751
3782
 
3752
3783
  The new sweepers can also observe on the actions themselves by implementing methods according to (before|after)_$controller_$action. Example of a callback that'll be called after PagesController#update_title has been performed:
3753
-
3784
+
3754
3785
  def after_pages_update_title
3755
3786
  expire_fragment(%r{pages/#{controller.assigns["page"].id}/.*})
3756
3787
  end
@@ -3789,16 +3820,16 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3789
3820
 
3790
3821
  * Added a wide range of new Javascript effects:
3791
3822
  * Effect.Puff zooms the element out and makes it smoothly transparent at the same time, giving a "puff" illusion #996 [thomas@fesch.at]
3792
- After the animation is completed, the display property will be set to none.
3823
+ After the animation is completed, the display property will be set to none.
3793
3824
  This effect will work on relative and absolute positioned elements.
3794
-
3825
+
3795
3826
  * Effect.Appear as the opposite of Effect.Fade #990 [thomas@fesch.at]
3796
3827
  You should return elements with style="display:none;" or a like class for this to work best and have no chance of flicker.
3797
-
3828
+
3798
3829
  * Effect.Squish for scaling down an element and making it disappear at the end #972 [thomas@fesch.at]
3799
-
3830
+
3800
3831
  * Effect.Scale for smoothly scaling images or text up and down #972 [thomas@fesch.at]
3801
-
3832
+
3802
3833
  * Effect.Fade which smoothly turns opacity from 100 to 0 and then hides the element #960 [thomas@fesch.at]
3803
3834
 
3804
3835
  * Added Request#xml_http_request? (and an alias xhr?) to that'll return true when the request came from one of the Javascript helper methods (Ajax). This can be used to give one behavior for modern browsers supporting Ajax, another to old browsers #1127 [Sam Stephenson]
@@ -3806,11 +3837,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3806
3837
  * Changed render_partial to take local assigns as the second parameter instead of an explicit object and then the assigns. So the API changes from:
3807
3838
 
3808
3839
  <%= render_partial "account", person, "rules" => regulations.rules %>
3809
-
3840
+
3810
3841
  ...to:
3811
-
3842
+
3812
3843
  <%= render_partial "account", :account => person, :rules => regulations.rules %>
3813
-
3844
+
3814
3845
  The old API will still work, though, and render_partial "account" will still assume :account => @account.
3815
3846
 
3816
3847
  * Added support for web servers that use PATH_INFO instead of REQUEST_URI like IIS #1014 [BradG/Nicholas Seckar]
@@ -3951,7 +3982,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3951
3982
  flash.now[:message] = 'Save failed, review'
3952
3983
  render_action 'edit'
3953
3984
  end
3954
- end
3985
+ end
3955
3986
  end
3956
3987
 
3957
3988
  * Added to_param call for parameters when composing an url using url_for from something else than strings #812 [Sam Stephenson]. Example:
@@ -3989,7 +4020,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
3989
4020
 
3990
4021
  A request for /categories/top-level-cat, would give @params[:path_info] with "top-level-cat".
3991
4022
  A request for /categories/top-level-cat/level-1-cat, would give @params[:path_info] with "top-level-cat/level-1-cat" and so forth.
3992
-
4023
+
3993
4024
  The @params[:path_info] return is really an array, but where to_s has been overwritten to do join("/").
3994
4025
 
3995
4026
  * Fixed options_for_select on selected line issue #624 [Florian Weber]
@@ -4110,11 +4141,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4110
4141
  def test_create_post
4111
4142
  post :create, "post" => { "title" => "Exciting!" }
4112
4143
  assert_redirected_to :action => "show"
4113
-
4144
+
4114
4145
  follow_redirect
4115
4146
  assert_rendered_file "post/show"
4116
4147
  end
4117
-
4148
+
4118
4149
  Limitation: Only works for redirects to other actions within the same controller.
4119
4150
 
4120
4151
  * Fixed double requiring of models with the same name as the controller
@@ -4139,9 +4170,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4139
4170
  <%= text_field "student[]", "last_name" %>
4140
4171
  <%= text_field "student[]", "grade", :size => "5" %>
4141
4172
  <% end %>
4142
-
4173
+
4143
4174
  ...would produce, for say David Black with id 123 and a grace of C+:
4144
-
4175
+
4145
4176
  <input id="student_123_first_name" name="student[123][first_name]" size="20" size="30" type="text" value="David" />
4146
4177
  <input id="student_123_last_name" name="student[123][last_name]" size="30" type="text" value="Black" />
4147
4178
  <input id="student_123_grade" name="student[123][grade]" size="5" type="text" value="C+" />
@@ -4171,7 +4202,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4171
4202
 
4172
4203
  class WeblogController
4173
4204
  before_filter { |c| c.send(:redirect_to_url("http://www.farfaraway.com")}) }
4174
-
4205
+
4175
4206
  def hello
4176
4207
  render_text "I will never be called"
4177
4208
  end
@@ -4184,7 +4215,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4184
4215
  redirect_to :action => "elsewhere"
4185
4216
  render_action "overthere"
4186
4217
  end
4187
-
4218
+
4188
4219
  Only the redirect happens. The rendering call is simply ignored.
4189
4220
 
4190
4221
 
@@ -4194,12 +4225,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4194
4225
 
4195
4226
  * Added assert_cookie_equal to assert the contents of a named cookie
4196
4227
 
4197
- * Fixed bug in page caching that prevented it from working at all
4228
+ * Fixed bug in page caching that prevented it from working at all
4198
4229
 
4199
4230
 
4200
4231
  *1.3.0* (January 17th, 2005)
4201
4232
 
4202
- * Added an extensive caching module that offers three levels of granularity (page, action, fragment) and a variety of stores.
4233
+ * Added an extensive caching module that offers three levels of granularity (page, action, fragment) and a variety of stores.
4203
4234
  Read more in ActionController::Caching.
4204
4235
 
4205
4236
  * Added the option of passing a block to ActiveRecordHelper#form in order to add more to the auto-generated form #469 [dom@sisna.com]
@@ -4238,9 +4269,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4238
4269
 
4239
4270
  * Fixed three issues with retrying breakpoints #417 [Florian Gross]
4240
4271
 
4241
- 1. Don't screw up pages that use multiple values for the same parameter (?foo=bar&foo=qux was converted to ?foo=barqux)
4242
- 2. Don't screw up all forms when you click the "Retry with Breakpoint" link multiple times instead of reloading
4243
- (This caused the parameters to be added multiple times for GET forms leading to trouble.)
4272
+ 1. Don't screw up pages that use multiple values for the same parameter (?foo=bar&foo=qux was converted to ?foo=barqux)
4273
+ 2. Don't screw up all forms when you click the "Retry with Breakpoint" link multiple times instead of reloading
4274
+ (This caused the parameters to be added multiple times for GET forms leading to trouble.)
4244
4275
  3. Don't add ?BP-RETRY=1 multiple times
4245
4276
 
4246
4277
  * Added that all renders and redirects now return false, so they can be used as the last line in before_filters to stop execution.
@@ -4252,7 +4283,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4252
4283
  return false
4253
4284
  end
4254
4285
  end
4255
-
4286
+
4256
4287
  After:
4257
4288
  def authenticate
4258
4289
  redirect_to(:controller => "account", :action => "login") unless @session[:authenticated]
@@ -4263,7 +4294,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4263
4294
  class JournalController < ActionController::Base
4264
4295
  # only require authentication if the current action is edit or delete
4265
4296
  before_filter :authorize, :only_on => [ :edit, :delete ]
4266
-
4297
+
4267
4298
  private
4268
4299
  def authorize
4269
4300
  # redirect to login unless authenticated
@@ -4307,7 +4338,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4307
4338
  * Added more informative exception when using helper :some_helper and the helper requires another file that fails, you'll get an
4308
4339
  error message tells you what file actually failed to load, rather than falling back on assuming it was the helper file itself #346 [dblack]
4309
4340
 
4310
- * Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
4341
+ * Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
4311
4342
  validation where the value would normally be "100".
4312
4343
 
4313
4344
  * Added Request#port_string to get something like ":8080" back on 8080 and "" on 80 (or 443 with https).
@@ -4354,15 +4385,15 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4354
4385
  scaffold :<%= singular_name %>
4355
4386
  <% end %>
4356
4387
  helper :post
4357
-
4388
+
4358
4389
  ...produces this on post as singular_name:
4359
4390
 
4360
4391
  class SomeController < ApplicationController
4361
-
4392
+
4362
4393
  scaffold :post
4363
-
4394
+
4364
4395
  helper :post
4365
-
4396
+
4366
4397
  ...where as:
4367
4398
 
4368
4399
  class SomeController < ApplicationController
@@ -4370,18 +4401,18 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4370
4401
  scaffold :<%= singular_name %>
4371
4402
  <% end -%>
4372
4403
  helper :post
4373
-
4404
+
4374
4405
  ...produces:
4375
4406
 
4376
4407
  class SomeController < ApplicationController
4377
4408
  scaffold :post
4378
4409
  helper :post
4379
-
4410
+
4380
4411
  [This undocumented gem for ERb was uncovered by bitsweat]
4381
4412
 
4382
4413
  * Fixed CgiRequest so that it'll now accept session options with Symbols as keys (as the documentation points out) [Suggested by Andreas]
4383
4414
 
4384
- * Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
4415
+ * Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
4385
4416
  local_assigns hash that overrides it. As a result, render_collection_of_partials can still be written in terms of render_partial
4386
4417
  and partials that make use of a counter can be called without problems from both render_collection_of_partials as well as
4387
4418
  render_partial #295 [Marcel Molina Jr.]
@@ -4396,12 +4427,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4396
4427
  link:classes/ActionController/Base.html#M000021. It's also possible to pass a string instead of an options hash to
4397
4428
  get a link tag that just points without consideration. The <tt>html_options</tt> works jointly for the image and ahref tag by
4398
4429
  letting the following special values enter the options on the image and the rest goes to the ahref:
4399
-
4430
+
4400
4431
  ::alt: If no alt text is given, the file name part of the +src+ is used (capitalized and without the extension)
4401
4432
  ::size: Supplied as "XxY", so "30x45" becomes width="30" and height="45"
4402
4433
  ::align: Sets the alignment, no special features
4403
-
4404
- The +src+ can be supplied as a...
4434
+
4435
+ The +src+ can be supplied as a...
4405
4436
  * full path, like "/my_images/image.gif"
4406
4437
  * file name, like "rss.gif", that gets expanded to "/images/rss.gif"
4407
4438
  * file name without extension, like "logo", that gets expanded to "/images/logo.png"
@@ -4416,10 +4447,10 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4416
4447
 
4417
4448
  # Calls Controller#miletone with a GET request
4418
4449
  process :milestone
4419
-
4450
+
4420
4451
  # Calls Controller#miletone with a POST request that has parameters
4421
4452
  post :milestone, { "name" => "David" }
4422
-
4453
+
4423
4454
  # Calls Controller#milestone with a HEAD request that has both parameters and session data
4424
4455
  head :milestone, { "id" => 1 }, { "user_id" => 23 }
4425
4456
 
@@ -4429,7 +4460,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4429
4460
 
4430
4461
  * Added indifference to whether @headers["Content-Type"], @headers["Content-type"], or @headers["content-type"] is used.
4431
4462
 
4432
- * Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
4463
+ * Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
4433
4464
  cookie-based sessions #275 [jcf]
4434
4465
 
4435
4466
  * Fixed that cached template loading would still check the file system to see if the file existed #258 [Andreas Schwarz]
@@ -4444,9 +4475,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4444
4475
 
4445
4476
  cookies["user_name"] = "david" # => Will set a simple session cookie
4446
4477
  cookies["login"] = { "value" => "XJ-122", "expires" => Time.now + 360} # => Will set a cookie that expires in 1 hour
4447
-
4478
+
4448
4479
  Examples for reading:
4449
-
4480
+
4450
4481
  cookies["user_name"] # => "david"
4451
4482
  cookies.size # => 2
4452
4483
 
@@ -4481,14 +4512,14 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4481
4512
  class MsgController < ApplicationController
4482
4513
  helper :msg
4483
4514
  end
4484
-
4515
+
4485
4516
  ...you can just do:
4486
-
4517
+
4487
4518
  class MsgController < ApplicationController
4488
4519
  end
4489
4520
 
4490
4521
  * Added dependencies_on(layer) to query the dependencies of a controller. Examples:
4491
-
4522
+
4492
4523
  MsgController.dependencies_on(:model) # => [ :post, :comment, :attachment ]
4493
4524
  MsgController.dependencies_on(:service) # => [ :notification_service ]
4494
4525
  MsgController.dependencies_on(:observer) # => [ :comment_observer ]
@@ -4543,7 +4574,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4543
4574
  class WeblogController < ActionController::Base
4544
4575
  include WeblogHelper
4545
4576
  end
4546
-
4577
+
4547
4578
  After:
4548
4579
 
4549
4580
  module WeblogHelper
@@ -4579,10 +4610,10 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4579
4610
 
4580
4611
  * Changed scaffolding of forms to use <label> tags instead of <b> to please W3C [evl]
4581
4612
 
4582
- * Added DateHelper#distance_of_time_in_words_to_now(from_time) that works like distance_of_time_in_words,
4613
+ * Added DateHelper#distance_of_time_in_words_to_now(from_time) that works like distance_of_time_in_words,
4583
4614
  but where <tt>to_time</tt> is fixed to <tt>Time.now</tt>.
4584
4615
 
4585
- * Added assert_flash_equal(expected, key, message), assert_session_equal(expected, key, message),
4616
+ * Added assert_flash_equal(expected, key, message), assert_session_equal(expected, key, message),
4586
4617
  assert_assigned_equal(expected, key, message) to test the contents of flash, session, and template assigns.
4587
4618
 
4588
4619
  * Improved the failure report on assert_success when the action triggered a redirection [alexey].
@@ -4607,7 +4638,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4607
4638
  xml.description "Basecamp: Recent items"
4608
4639
  xml.language "en-us"
4609
4640
  xml.ttl "40"
4610
-
4641
+
4611
4642
  for item in @recent_items
4612
4643
  xml.item do
4613
4644
  xml.title(item_title(item))
@@ -4615,7 +4646,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4615
4646
  xml.pubDate(item_pubDate(item))
4616
4647
  xml.guid(@person.firm.account.url + @recent_items.url(item))
4617
4648
  xml.link(@person.firm.account.url + @recent_items.url(item))
4618
-
4649
+
4619
4650
  xml.tag!("dc:creator", item.author_name) if item_has_creator?(item)
4620
4651
  end
4621
4652
  end
@@ -4652,12 +4683,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4652
4683
  of the tag you want. Options for the tag can be specified as a hash parameter to that method.
4653
4684
 
4654
4685
  Builder-based templates can be mixed and matched with the regular ERb ones. The only thing that differentiates them is the extension.
4655
- No new methods have been added to the public interface to handle them.
4656
-
4686
+ No new methods have been added to the public interface to handle them.
4687
+
4657
4688
  Action Pack ships with a version of Builder, but it will use the RubyGems version if you have one installed.
4658
-
4689
+
4659
4690
  Read more about Builder on: http://onestepback.org/index.cgi/Tech/Ruby/StayingSimple.rdoc
4660
-
4691
+
4661
4692
  [Builder is created by Jim Weirich]
4662
4693
 
4663
4694
  * Added much improved support for functional testing [what-a-day].
@@ -4668,9 +4699,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4668
4699
  @request.action = "authenticate"
4669
4700
  @request.request_parameters["user_name"] = "nop"
4670
4701
  @request.request_parameters["password"] = ""
4671
-
4702
+
4672
4703
  response = LoginController.process_test(@request)
4673
-
4704
+
4674
4705
  assert_equal "The username and/or password you entered is invalid.", response.session["flash"]["alert"]
4675
4706
  assert_equal "http://37signals.basecamp.com/login/", response.headers["location"]
4676
4707
  end
@@ -4684,7 +4715,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4684
4715
 
4685
4716
  See a full example on http://codepaste.org/view/paste/334
4686
4717
 
4687
- * Increased performance by up to 100% with a revised cookie class that fixes the performance problems with the
4718
+ * Increased performance by up to 100% with a revised cookie class that fixes the performance problems with the
4688
4719
  default one that ships with 1.8.1 and below. It replaces the inheritance on SimpleDelegator with DelegateClass(Array)
4689
4720
  following the suggestion from Matz on:
4690
4721
  http://groups.google.com/groups?th=e3a4e68ba042f842&seekm=c3sioe%241qvm%241%40news.cybercity.dk#link14
@@ -4694,9 +4725,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4694
4725
  * Added implicit counter variable to render_collection_of_partials [Marcel Molina Jr.]. From the docs:
4695
4726
 
4696
4727
  <%= render_collection_of_partials "ad", @advertisements %>
4697
-
4728
+
4698
4729
  This will render "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display. An iteration counter
4699
- will automatically be made available to the template with a name of the form +partial_name_counter+. In the case of the
4730
+ will automatically be made available to the template with a name of the form +partial_name_counter+. In the case of the
4700
4731
  example above, the template would be fed +ad_counter+.
4701
4732
 
4702
4733
  * Fixed problems with two sessions being maintained on reset_session that would particularly screw up ActiveRecordStore.
@@ -4712,15 +4743,15 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4712
4743
 
4713
4744
  * Added JavaScript confirm feature to link_to. Documentation:
4714
4745
 
4715
- The html_options have a special feature for creating javascript confirm alerts where if you pass
4746
+ The html_options have a special feature for creating javascript confirm alerts where if you pass
4716
4747
  :confirm => 'Are you sure?', the link will be guarded with a JS popup asking that question.
4717
4748
  If the user accepts, the link is processed, otherwise not.
4718
4749
 
4719
4750
  * Added link_to_unless_current as a UrlHelper method [Sam Stephenson]. Documentation:
4720
4751
 
4721
- Creates a link tag of the given +name+ using an URL created by the set of +options+, unless the current
4752
+ Creates a link tag of the given +name+ using an URL created by the set of +options+, unless the current
4722
4753
  controller, action, and id are the same as the link's, in which case only the name is returned (or the
4723
- given block is yielded, if one exists). This is useful for creating link bars where you don't want to link
4754
+ given block is yielded, if one exists). This is useful for creating link bars where you don't want to link
4724
4755
  to the page currently being viewed.
4725
4756
 
4726
4757
  * Fixed that UrlRewriter (the driver for url_for, link_to, etc) would blow up when the anchor was an integer [alexey]
@@ -4740,9 +4771,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4740
4771
  * Added the possibility for shared partials. Example:
4741
4772
 
4742
4773
  <%= render_partial "advertisement/ad", ad %>
4743
-
4774
+
4744
4775
  This will render the partial "advertisement/_ad.rhtml" regardless of which controller this is being called from.
4745
-
4776
+
4746
4777
  [Jacob Fugal]
4747
4778
 
4748
4779
  * Fixed crash when encountering forms that have empty-named fields [James Prudente]
@@ -4768,7 +4799,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4768
4799
  ...can now be as:
4769
4800
 
4770
4801
  before_filter { |controller| return false if controller.params["stop_action"] }
4771
-
4802
+
4772
4803
  [Jeremy Kemper]
4773
4804
 
4774
4805
  * Made the following methods public (was protected): url_for, controller_class_name, controller_name, action_name
@@ -4781,7 +4812,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4781
4812
  * Changed base class setup from AbstractTemplate/ERbTemplate to ActionView::Base. This change should be harmless unless you were
4782
4813
  accessing Action View directly in which case you now need to reference the Base class.\
4783
4814
 
4784
- * Added that render_collection_of_partials returns nil if the collection is empty. This makes showing a “no items” message easier.
4815
+ * Added that render_collection_of_partials returns nil if the collection is empty. This makes showing a “no items” message easier.
4785
4816
  For example: <%= render_collection_of_partials("message", @messages) || "No messages found." %> [Sam Stephenson]
4786
4817
 
4787
4818
  * Added :month_before_year as an option to date_select to get the month select before the year. Especially useful for credit card forms.
@@ -4809,42 +4840,42 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4809
4840
 
4810
4841
  * Introduced passing of locally scoped variables between templates:
4811
4842
 
4812
- You can pass local variables to sub templates by using a hash of with the variable
4843
+ You can pass local variables to sub templates by using a hash of with the variable
4813
4844
  names as keys and the objects as values:
4814
-
4845
+
4815
4846
  <%= render "shared/header", { "headline" => "Welcome", "person" => person } %>
4816
-
4847
+
4817
4848
  These can now be accessed in shared/header with:
4818
-
4849
+
4819
4850
  Headline: <%= headline %>
4820
4851
  First name: <%= person.first_name %>
4821
-
4852
+
4822
4853
  * Introduced the concept of partials as a certain type of sub templates:
4823
4854
 
4824
- There's also a convenience method for rendering sub templates within the current
4825
- controller that depends on a single object (we call this kind of sub templates for
4855
+ There's also a convenience method for rendering sub templates within the current
4856
+ controller that depends on a single object (we call this kind of sub templates for
4826
4857
  partials). It relies on the fact that partials should follow the naming convention
4827
4858
  of being prefixed with an underscore -- as to separate them from regular templates
4828
4859
  that could be rendered on their own. In the template for Advertiser#buy, we could have:
4829
-
4860
+
4830
4861
  <% for ad in @advertisements %>
4831
4862
  <%= render_partial "ad", ad %>
4832
4863
  <% end %>
4833
-
4834
- This would render "advertiser/_ad.rhtml" and pass the local variable +ad+
4864
+
4865
+ This would render "advertiser/_ad.rhtml" and pass the local variable +ad+
4835
4866
  for the template to display.
4836
-
4867
+
4837
4868
  == Rendering a collection of partials
4838
-
4869
+
4839
4870
  The example of partial use describes a familar pattern where a template needs
4840
- to iterate over a array and render a sub template for each of the elements.
4841
- This pattern has been implemented as a single method that accepts an array and
4842
- renders a partial by the same name of as the elements contained within. So the
4871
+ to iterate over a array and render a sub template for each of the elements.
4872
+ This pattern has been implemented as a single method that accepts an array and
4873
+ renders a partial by the same name of as the elements contained within. So the
4843
4874
  three-lined example in "Using partials" can be rewritten with a single line:
4844
-
4875
+
4845
4876
  <%= render_collection_of_partials "ad", @advertisements %>
4846
-
4847
- So this will render "advertiser/_ad.rhtml" and pass the local variable +ad+ for
4877
+
4878
+ So this will render "advertiser/_ad.rhtml" and pass the local variable +ad+ for
4848
4879
  the template to display.
4849
4880
 
4850
4881
  * Improved send_file by allowing a wide range of options to be applied [Jeremy Kemper]:
@@ -4852,36 +4883,36 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4852
4883
  Sends the file by streaming it 4096 bytes at a time. This way the
4853
4884
  whole file doesn't need to be read into memory at once. This makes
4854
4885
  it feasible to send even large files.
4855
-
4886
+
4856
4887
  Be careful to sanitize the path parameter if it coming from a web
4857
4888
  page. send_file(@params['path'] allows a malicious user to
4858
4889
  download any file on your server.
4859
-
4890
+
4860
4891
  Options:
4861
- * <tt>:filename</tt> - specifies the filename the browser will see.
4892
+ * <tt>:filename</tt> - specifies the filename the browser will see.
4862
4893
  Defaults to File.basename(path).
4863
- * <tt>:type</tt> - specifies an HTTP content type.
4894
+ * <tt>:type</tt> - specifies an HTTP content type.
4864
4895
  Defaults to 'application/octet-stream'.
4865
- * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
4896
+ * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
4866
4897
  Valid values are 'inline' and 'attachment' (default).
4867
4898
  * <tt>:buffer_size</tt> - specifies size (in bytes) of the buffer used to stream
4868
4899
  the file. Defaults to 4096.
4869
-
4900
+
4870
4901
  The default Content-Type and Content-Disposition headers are
4871
4902
  set to download arbitrary binary files in as many browsers as
4872
4903
  possible. IE versions 4, 5, 5.5, and 6 are all known to have
4873
4904
  a variety of quirks (especially when downloading over SSL).
4874
-
4905
+
4875
4906
  Simple download:
4876
4907
  send_file '/path/to.zip'
4877
-
4908
+
4878
4909
  Show a JPEG in browser:
4879
4910
  send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
4880
-
4911
+
4881
4912
  Read about the other Content-* HTTP headers if you'd like to
4882
4913
  provide the user with more information (such as Content-Description).
4883
4914
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
4884
-
4915
+
4885
4916
  Also be aware that the document may be cached by proxies and browsers.
4886
4917
  The Pragma and Cache-Control headers declare how the file may be cached
4887
4918
  by intermediaries. They default to require clients to validate with
@@ -4908,74 +4939,74 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4908
4939
 
4909
4940
  * Added select, collection_select, and country_select to make it easier for Active Records to set attributes through
4910
4941
  drop-down lists of options. Example:
4911
-
4942
+
4912
4943
  <%= select "person", "gender", %w( Male Female ) %>
4913
-
4944
+
4914
4945
  ...would give the following:
4915
-
4946
+
4916
4947
  <select name="person[gender]" id="person_gender"><option>Male</option><option>Female</option></select>
4917
4948
 
4918
4949
  * Added an option for getting multiple values on a single form name into an array instead of having the last one overwrite.
4919
4950
  This is especially useful for groups of checkboxes, which can now be written as:
4920
-
4951
+
4921
4952
  <input type="checkbox" name="rights[]" value="CREATE" />
4922
4953
  <input type="checkbox" name="rights[]" value="UPDATE" />
4923
4954
  <input type="checkbox" name="rights[]" value="DELETE" />
4924
-
4955
+
4925
4956
  ...and retrieved in the controller action with:
4926
-
4957
+
4927
4958
  @params["rights"] # => [ "CREATE", "UPDATE", "DELETE" ]
4928
-
4929
- The old behavior (where the last one wins, "DELETE" in the example) is still available. Just don't add "[]" to the
4959
+
4960
+ The old behavior (where the last one wins, "DELETE" in the example) is still available. Just don't add "[]" to the
4930
4961
  end of the name. [Scott Baron]
4931
-
4962
+
4932
4963
  * Added send_file which uses the new render_text block acceptance to make it feasible to send large files.
4933
- The files is sent with a bunch of voodoo HTTP headers required to get arbitrary files to download as
4964
+ The files is sent with a bunch of voodoo HTTP headers required to get arbitrary files to download as
4934
4965
  expected in as many browsers as possible (eg, IE hacks). Example:
4935
-
4966
+
4936
4967
  def play_movie
4937
4968
  send_file "/movies/that_movie.avi"
4938
4969
  end
4939
-
4970
+
4940
4971
  [Jeremy Kemper]
4941
4972
 
4942
- * render_text now accepts a block for deferred rendering. Useful for streaming large files, displaying
4973
+ * render_text now accepts a block for deferred rendering. Useful for streaming large files, displaying
4943
4974
  a “please wait” message during a complex search, etc. Streaming example:
4944
-
4975
+
4945
4976
  render_text do |response|
4946
4977
  File.open(path, 'rb') do |file|
4947
4978
  while buf = file.read(1024)
4948
- print buf
4949
- end
4979
+ print buf
4980
+ end
4950
4981
  end
4951
4982
  end
4952
-
4983
+
4953
4984
  [Jeremy Kemper]
4954
4985
 
4955
4986
  * Added a new Tag Helper that can generate generic tags programmatically insted of through HTML. Example:
4956
-
4987
+
4957
4988
  tag("br", "clear" => "all") => <br clear="all" />
4958
-
4959
- ...that's usually not terribly interesting (unless you have a lot of options already in a hash), but it
4989
+
4990
+ ...that's usually not terribly interesting (unless you have a lot of options already in a hash), but it
4960
4991
  gives way for more specific tags, like the new form tag:
4961
-
4992
+
4962
4993
  form_tag({ :controller => "weblog", :action => "update" }, { :multipart => "true", "style" => "width: 200px"}) =>
4963
4994
  <form action="/weblog/update" enctype="multipart/formdata" style="width: 200px">
4964
-
4995
+
4965
4996
  There's even a "pretty" version for people who don't like to open tags in code and close them in HTML:
4966
-
4997
+
4967
4998
  <%= start_form_tag :action => "update" %>
4968
4999
  # all the input fields
4969
5000
  <%= end_form_tag %>
4970
-
5001
+
4971
5002
  (end_form_tag just returns "</form>")
4972
5003
 
4973
- * The selected parameter in options_for_select may now also an array of values to be selected when
5004
+ * The selected parameter in options_for_select may now also an array of values to be selected when
4974
5005
  using a multiple select. Example:
4975
5006
 
4976
5007
  options_for_select([ "VISA", "Mastercard", "Discover" ], ["VISA", "Discover"]) =>
4977
5008
  <option selected>VISA</option>\n<option>Mastercard</option>\n<option selected>Discover</option>
4978
-
5009
+
4979
5010
  [Scott Baron]
4980
5011
 
4981
5012
  * Changed the URL rewriter so controller_prefix and action_prefix can be used in isolation. You can now do:
@@ -4983,7 +5014,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4983
5014
  url_for(:controller_prefix => "clients")
4984
5015
 
4985
5016
  ...or:
4986
-
5017
+
4987
5018
  url_for(:action_prefix => "category/messages")
4988
5019
 
4989
5020
  Neither would have worked in isolation before (:controller_prefix required a :controller and :action_prefix required an :action)
@@ -4991,7 +5022,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
4991
5022
  * Started process of a cleaner separation between Action Controller and ERb-based Action Views by introducing an
4992
5023
  abstract base class for views. And Amita adapter could be fitted in more easily now.
4993
5024
 
4994
- * The date helper methods date_select and datetime_select now also use the field error wrapping
5025
+ * The date helper methods date_select and datetime_select now also use the field error wrapping
4995
5026
  (div with class fieldWithErrors by default).
4996
5027
 
4997
5028
  * The date helper methods date_select and datetime_select can now discard selects
@@ -5003,7 +5034,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5003
5034
  end
5004
5035
 
5005
5036
  ...would give the following on a Post#title (text field) error:
5006
-
5037
+
5007
5038
  <p>Title can't be empty</p>
5008
5039
  <div style='background-color: red'>
5009
5040
  <input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />
@@ -5036,18 +5067,18 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5036
5067
  layout "layouts/weblog"
5037
5068
  scaffold :post
5038
5069
  end
5039
-
5070
+
5040
5071
  [Suggested by Scott]
5041
5072
 
5042
5073
  * Changed url_for (and all the that drives, like redirect_to, link_to, link_for) so you can pass it a symbol instead of a hash.
5043
5074
  This symbol is a method reference which is then called to calculate the url. Example:
5044
-
5075
+
5045
5076
  class WeblogController < ActionController::Base
5046
5077
  def update
5047
5078
  # do some update
5048
5079
  redirect_to :dashboard_url
5049
5080
  end
5050
-
5081
+
5051
5082
  protected
5052
5083
  def dashboard_url
5053
5084
  if @project.active?
@@ -5057,23 +5088,23 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5057
5088
  end
5058
5089
  end
5059
5090
  end
5060
-
5091
+
5061
5092
  * Added default_url_options to specialize behavior for all url_for (and friends) calls:
5062
5093
 
5063
- Overwrite to implement a number of default options that all url_for-based methods will use.
5064
- The default options should come in form of a hash, just like the one you would use for
5094
+ Overwrite to implement a number of default options that all url_for-based methods will use.
5095
+ The default options should come in form of a hash, just like the one you would use for
5065
5096
  url_for directly. Example:
5066
-
5097
+
5067
5098
  def default_url_options(options)
5068
5099
  { :controller_prefix => @project.active? ? "projects/" : "accounts/" }
5069
5100
  end
5070
-
5071
- As you can infer from the example, this is mostly useful for situations where you want to
5101
+
5102
+ As you can infer from the example, this is mostly useful for situations where you want to
5072
5103
  centralize dynamic dissions about the urls as they stem from the business domain. Please note
5073
5104
  that any individual url_for call can always override the defaults set by this method.
5074
-
5075
5105
 
5076
- * Changed url_for so that an "id" passed in the :params is not treated special. You need to use the dedicated :id to get
5106
+
5107
+ * Changed url_for so that an "id" passed in the :params is not treated special. You need to use the dedicated :id to get
5077
5108
  the special auto path-params treatment. Considering the url http://localhost:81/friends/list
5078
5109
 
5079
5110
  url_for(:action => "show", :params => { "id" => 5 })
@@ -5091,7 +5122,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5091
5122
 
5092
5123
  *0.7.8*
5093
5124
 
5094
- * Fixed session bug where you couldn't store any objects that didn't exist in the standard library
5125
+ * Fixed session bug where you couldn't store any objects that didn't exist in the standard library
5095
5126
  (such as Active Record objects).
5096
5127
 
5097
5128
  * Added reset_session method for Action Controller objects to clear out all objects in the session.
@@ -5102,22 +5133,22 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5102
5133
 
5103
5134
  class WeblogController < ActionController::Base
5104
5135
  around_filter BenchmarkingFilter.new
5105
-
5136
+
5106
5137
  # Before this action is performed, BenchmarkingFilter#before(controller) is executed
5107
5138
  def index
5108
5139
  end
5109
5140
  # After this action has been performed, BenchmarkingFilter#after(controller) is executed
5110
5141
  end
5111
-
5142
+
5112
5143
  class BenchmarkingFilter
5113
5144
  def initialize
5114
5145
  @runtime
5115
5146
  end
5116
-
5147
+
5117
5148
  def before
5118
5149
  start_timer
5119
5150
  end
5120
-
5151
+
5121
5152
  def after
5122
5153
  stop_timer
5123
5154
  report_result
@@ -5128,7 +5159,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5128
5159
 
5129
5160
  text_field "post", "title"
5130
5161
  ...just gives: <input id="post_title" name="post[title]" size="30" type="text" value="" />
5131
-
5162
+
5132
5163
  text_field "post", "title", "id" => "title_for_post", "name" => "first_post_title"
5133
5164
  ...can now give: <input id="title_for_post" name="first_post_title" size="30" type="text" value="" />
5134
5165
 
@@ -5156,7 +5187,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5156
5187
  * Included ERB::Util so all templates can easily escape HTML content with <%=h @person.content %>
5157
5188
 
5158
5189
  * All requests are now considered local by default, so everyone will be exposed to detailed debugging screens on errors.
5159
- When the application is ready to go public, set ActionController::Base.consider_all_requests_local to false,
5190
+ When the application is ready to go public, set ActionController::Base.consider_all_requests_local to false,
5160
5191
  and implement the protected method local_request? in the controller to determine when debugging screens should be shown.
5161
5192
 
5162
5193
  * Fixed three bugs with the url_for/redirect_to/link_to handling. Considering the url http://localhost:81/friends/show/1
@@ -5164,7 +5195,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5164
5195
  url_for(:action => "list")
5165
5196
  ...used to give http://localhost:81/friends/list/1
5166
5197
  ......now gives http://localhost:81/friends/list
5167
-
5198
+
5168
5199
  url_for(:controller => "friends", :action => "destroy", :id => 5)
5169
5200
  ...used to give http://localhost:81/friends/destroy
5170
5201
  ......now gives http://localhost:81/friends/destroy/5
@@ -5174,7 +5205,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
5174
5205
  url_for(:action => "list", :id => 5)
5175
5206
  ...used to give http://localhost:81/5eachers/list/t
5176
5207
  ......now gives http://localhost:81/teachers/list/5
5177
-
5208
+
5178
5209
  [Reported by David Morton & Radsaq]
5179
5210
 
5180
5211
  * Logs exception to logfile in addition to showing them for local requests