actionpack 0.9.0

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 (100) hide show
  1. data/CHANGELOG +604 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +418 -0
  4. data/RUNNING_UNIT_TESTS +14 -0
  5. data/examples/.htaccess +24 -0
  6. data/examples/address_book/index.rhtml +33 -0
  7. data/examples/address_book/layout.rhtml +8 -0
  8. data/examples/address_book_controller.cgi +9 -0
  9. data/examples/address_book_controller.fcgi +6 -0
  10. data/examples/address_book_controller.rb +52 -0
  11. data/examples/address_book_controller.rbx +4 -0
  12. data/examples/benchmark.rb +52 -0
  13. data/examples/benchmark_with_ar.fcgi +89 -0
  14. data/examples/blog_controller.cgi +53 -0
  15. data/examples/debate/index.rhtml +14 -0
  16. data/examples/debate/new_topic.rhtml +22 -0
  17. data/examples/debate/topic.rhtml +32 -0
  18. data/examples/debate_controller.cgi +57 -0
  19. data/install.rb +93 -0
  20. data/lib/action_controller.rb +47 -0
  21. data/lib/action_controller/assertions/action_pack_assertions.rb +166 -0
  22. data/lib/action_controller/assertions/active_record_assertions.rb +65 -0
  23. data/lib/action_controller/base.rb +626 -0
  24. data/lib/action_controller/benchmarking.rb +49 -0
  25. data/lib/action_controller/cgi_ext/cgi_ext.rb +43 -0
  26. data/lib/action_controller/cgi_ext/cgi_methods.rb +91 -0
  27. data/lib/action_controller/cgi_process.rb +123 -0
  28. data/lib/action_controller/filters.rb +279 -0
  29. data/lib/action_controller/flash.rb +65 -0
  30. data/lib/action_controller/layout.rb +143 -0
  31. data/lib/action_controller/request.rb +92 -0
  32. data/lib/action_controller/rescue.rb +94 -0
  33. data/lib/action_controller/response.rb +15 -0
  34. data/lib/action_controller/scaffolding.rb +183 -0
  35. data/lib/action_controller/session/active_record_store.rb +72 -0
  36. data/lib/action_controller/session/drb_server.rb +9 -0
  37. data/lib/action_controller/session/drb_store.rb +31 -0
  38. data/lib/action_controller/support/class_attribute_accessors.rb +57 -0
  39. data/lib/action_controller/support/class_inheritable_attributes.rb +37 -0
  40. data/lib/action_controller/support/clean_logger.rb +10 -0
  41. data/lib/action_controller/support/cookie_performance_fix.rb +121 -0
  42. data/lib/action_controller/support/inflector.rb +70 -0
  43. data/lib/action_controller/templates/rescues/_request_and_response.rhtml +28 -0
  44. data/lib/action_controller/templates/rescues/diagnostics.rhtml +22 -0
  45. data/lib/action_controller/templates/rescues/layout.rhtml +29 -0
  46. data/lib/action_controller/templates/rescues/missing_template.rhtml +2 -0
  47. data/lib/action_controller/templates/rescues/template_error.rhtml +26 -0
  48. data/lib/action_controller/templates/rescues/unknown_action.rhtml +2 -0
  49. data/lib/action_controller/templates/scaffolds/edit.rhtml +6 -0
  50. data/lib/action_controller/templates/scaffolds/layout.rhtml +29 -0
  51. data/lib/action_controller/templates/scaffolds/list.rhtml +24 -0
  52. data/lib/action_controller/templates/scaffolds/new.rhtml +5 -0
  53. data/lib/action_controller/templates/scaffolds/show.rhtml +9 -0
  54. data/lib/action_controller/test_process.rb +194 -0
  55. data/lib/action_controller/url_rewriter.rb +153 -0
  56. data/lib/action_view.rb +40 -0
  57. data/lib/action_view/base.rb +253 -0
  58. data/lib/action_view/helpers/active_record_helper.rb +171 -0
  59. data/lib/action_view/helpers/date_helper.rb +223 -0
  60. data/lib/action_view/helpers/debug_helper.rb +17 -0
  61. data/lib/action_view/helpers/form_helper.rb +176 -0
  62. data/lib/action_view/helpers/form_options_helper.rb +169 -0
  63. data/lib/action_view/helpers/tag_helper.rb +59 -0
  64. data/lib/action_view/helpers/text_helper.rb +129 -0
  65. data/lib/action_view/helpers/url_helper.rb +72 -0
  66. data/lib/action_view/partials.rb +61 -0
  67. data/lib/action_view/template_error.rb +84 -0
  68. data/lib/action_view/vendor/builder.rb +13 -0
  69. data/lib/action_view/vendor/builder/blankslate.rb +21 -0
  70. data/lib/action_view/vendor/builder/xmlbase.rb +143 -0
  71. data/lib/action_view/vendor/builder/xmlevents.rb +63 -0
  72. data/lib/action_view/vendor/builder/xmlmarkup.rb +288 -0
  73. data/rakefile +105 -0
  74. data/test/abstract_unit.rb +9 -0
  75. data/test/controller/action_pack_assertions_test.rb +295 -0
  76. data/test/controller/active_record_assertions_test.rb +118 -0
  77. data/test/controller/cgi_test.rb +142 -0
  78. data/test/controller/cookie_test.rb +38 -0
  79. data/test/controller/filters_test.rb +159 -0
  80. data/test/controller/flash_test.rb +69 -0
  81. data/test/controller/layout_test.rb +49 -0
  82. data/test/controller/redirect_test.rb +44 -0
  83. data/test/controller/render_test.rb +169 -0
  84. data/test/controller/url_test.rb +318 -0
  85. data/test/fixtures/layouts/builder.rxml +3 -0
  86. data/test/fixtures/layouts/standard.rhtml +1 -0
  87. data/test/fixtures/test/_customer.rhtml +1 -0
  88. data/test/fixtures/test/greeting.rhtml +1 -0
  89. data/test/fixtures/test/hello.rxml +4 -0
  90. data/test/fixtures/test/hello_world.rhtml +1 -0
  91. data/test/fixtures/test/hello_xml_world.rxml +11 -0
  92. data/test/fixtures/test/list.rhtml +1 -0
  93. data/test/template/active_record_helper_test.rb +76 -0
  94. data/test/template/date_helper_test.rb +103 -0
  95. data/test/template/form_helper_test.rb +115 -0
  96. data/test/template/form_options_helper_test.rb +174 -0
  97. data/test/template/tag_helper_test.rb +18 -0
  98. data/test/template/text_helper_test.rb +62 -0
  99. data/test/template/url_helper_test.rb +35 -0
  100. metadata +154 -0
@@ -0,0 +1,604 @@
1
+ *0.9.0 (43)*
2
+
3
+ * Added support for Builder-based templates for files with the .rxml extension. These new templates are an alternative to ERb that
4
+ are especially useful for generating XML content, such as this RSS example from Basecamp:
5
+
6
+ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
7
+ xml.channel do
8
+ xml.title(@feed_title)
9
+ xml.link(@url)
10
+ xml.description "Basecamp: Recent items"
11
+ xml.language "en-us"
12
+ xml.ttl "40"
13
+
14
+ for item in @recent_items
15
+ xml.item do
16
+ xml.title(item_title(item))
17
+ xml.description(item_description(item)) if item_description(item)
18
+ xml.pubDate(item_pubDate(item))
19
+ xml.guid(@person.firm.account.url + @recent_items.url(item))
20
+ xml.link(@person.firm.account.url + @recent_items.url(item))
21
+
22
+ xml.tag!("dc:creator", item.author_name) if item_has_creator?(item)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ ...which will generate something like:
29
+
30
+ <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
31
+ <channel>
32
+ <title>Web Site Redesign</title>
33
+ <link>http://www.basecamphq.com/clients/travelcenter/1/</link>
34
+ <description>Basecamp: Recent items</description>
35
+ <language>en-us</language>
36
+ <ttl>40</ttl>
37
+ <item>
38
+ <title>Post: don't you know</title>
39
+ <description>&amp;lt;p&amp;gt;deeper and down&amp;lt;/p&amp;gt;</description>
40
+ <pubDate>Fri, 20 Aug 2004 21:13:50 CEST</pubDate>
41
+ <guid>http://www.basecamphq.com/clients/travelcenter/1/msg/assets/96976/comments</guid>
42
+ <link>http://www.basecamphq.com/clients/travelcenter/1/msg/assets/96976/comments</link>
43
+ <dc:creator>David H. Heinemeier</dc:creator>
44
+ </item>
45
+ <item>
46
+ <title>Milestone completed: Design Comp 2</title>
47
+ <pubDate>Mon, 9 Aug 2004 14:42:06 CEST</pubDate>
48
+ <guid>http://www.basecamphq.com/clients/travelcenter/1/milestones/#49</guid>
49
+ <link>http://www.basecamphq.com/clients/travelcenter/1/milestones/#49</link>
50
+ </item>
51
+ </channel>
52
+ </rss>
53
+
54
+ The "xml" local variable is automatically available in .rxml templates. You construct the template by calling a method with the name
55
+ of the tag you want. Options for the tag can be specified as a hash parameter to that method.
56
+
57
+ Builder-based templates can be mixed and matched with the regular ERb ones. The only thing that differentiates them is the extension.
58
+ No new methods have been added to the public interface to handle them.
59
+
60
+ Action Pack ships with a version of Builder, but it will use the RubyGems version if you have one installed.
61
+
62
+ Read more about Builder on: http://onestepback.org/index.cgi/Tech/Ruby/StayingSimple.rdoc
63
+
64
+ [Builder is created by Jim Weirich]
65
+
66
+ * Added much improved support for functional testing [what-a-day].
67
+
68
+ # Old style
69
+ def test_failing_authenticate
70
+ @request.request_uri = "/login/authenticate"
71
+ @request.action = "authenticate"
72
+ @request.request_parameters["user_name"] = "nop"
73
+ @request.request_parameters["password"] = ""
74
+
75
+ response = LoginController.process_test(@request)
76
+
77
+ assert_equal "The username and/or password you entered is invalid.", response.session["flash"]["alert"]
78
+ assert_equal "http://37signals.basecamp.com/login/", response.headers["location"]
79
+ end
80
+
81
+ # New style
82
+ def test_failing_authenticate
83
+ process :authenticate, "user_name" => "nop", "password" => ""
84
+ assert_flash_has 'alert'
85
+ assert_redirected_to :action => "index"
86
+ end
87
+
88
+ See a full example on http://codepaste.org/view/paste/334
89
+
90
+ * Increased performance by up to 100% with a revised cookie class that fixes the performance problems with the
91
+ default one that ships with 1.8.1 and below. It replaces the inheritance on SimpleDelegator with DelegateClass(Array)
92
+ following the suggestion from Matz on:
93
+ http://groups.google.com/groups?th=e3a4e68ba042f842&seekm=c3sioe%241qvm%241%40news.cybercity.dk#link14
94
+
95
+ * Added caching for compiled ERb templates. On Basecamp, it gave between 8.5% and 71% increase in performance [Andreas Schwarz].
96
+
97
+ * Added implicit counter variable to render_collection_of_partials [Marcel]. From the docs:
98
+
99
+ <%= render_collection_of_partials "ad", @advertisements %>
100
+
101
+ This will render "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display. An iteration counter
102
+ will automatically be made available to the template with a name of the form +partial_name_counter+. In the case of the
103
+ example above, the template would be fed +ad_counter+.
104
+
105
+ * Fixed problems with two sessions being maintained on reset_session that would particularly screw up ActiveRecordStore.
106
+
107
+ * Fixed reset_session to start an entirely new session instead of merely deleting the old. So you can now safely access @session
108
+ after calling reset_ression and expect it to work.
109
+
110
+ * Added @request.get?, @request.post?, @request.put?, @request.delete? as convenience query methods for @request.method [geech]
111
+
112
+ * Added @request.method that'll return a symbol representing the HTTP method, such as :get, :post, :put, :delete [geech]
113
+
114
+ * Changed @request.remote_ip and @request.host to work properly even when a proxy is in front of the application [geech]
115
+
116
+ * Added JavaScript confirm feature to link_to. Documentation:
117
+
118
+ The html_options have a special feature for creating javascript confirm alerts where if you pass
119
+ :confirm => 'Are you sure?', the link will be guarded with a JS popup asking that question.
120
+ If the user accepts, the link is processed, otherwise not.
121
+
122
+ * Added link_to_unless_current as a UrlHelper method [Sam Stephenson]. Documentation:
123
+
124
+ Creates a link tag of the given +name+ using an URL created by the set of +options+, unless the current
125
+ controller, action, and id are the same as the link's, in which case only the name is returned (or the
126
+ given block is yielded, if one exists). This is useful for creating link bars where you don't want to link
127
+ to the page currently being viewed.
128
+
129
+ * Fixed that UrlRewriter (the driver for url_for, link_to, etc) would blow up when the anchor was an integer [alexey]
130
+
131
+ * Added that layouts defined with no directory defaults to layouts. So layout "weblog/standard" will use
132
+ weblog/standard (as always), but layout "standard" will use layouts/standard.
133
+
134
+ * Fixed that partials (or any template starting with an underscore) was publically viewable [Marten]
135
+
136
+ * Added HTML escaping to text_area helper.
137
+
138
+ * Added :overwrite_params to url_for and friends to keep the parameters as they were passed to the current action and only overwrite a subset.
139
+ The regular :params will clear the slate so you need to manually add in existing parameters if you want to reuse them. [raphinou]
140
+
141
+ * Fixed scaffolding problem with composite named objects [Moo Jester]
142
+
143
+ * Added the possibility for shared partials. Example:
144
+
145
+ <%= render_partial "advertisement/ad", ad %>
146
+
147
+ This will render the partial "advertisement/_ad.rhtml" regardless of which controller this is being called from.
148
+
149
+ [Jacob Fugal]
150
+
151
+ * Fixed crash when encountering forms that have empty-named fields [James Prudente]
152
+
153
+ * Added check_box form helper method now accepts true/false as well as 1/0 [what-a-day]
154
+
155
+ * Fixed the lacking creation of all directories with install.rb [Dave Steinberg]
156
+
157
+ * Fixed that date_select returns valid XHTML selected options [Andreas Schwarz]
158
+
159
+ * Fixed referencing an action with the same name as a controller in url_for [what-a-day]
160
+
161
+ * Fixed the destructive nature of Base#attributes= on the argument [Kevin Watt]
162
+
163
+ * Changed ActionControllerError to decent from StandardError instead of Exception. It can now be caught by a generic rescue.
164
+
165
+ * Added SessionRestoreError that is raised when a session being restored holds objects where there is no class available.
166
+
167
+ * Added block as option for inline filters. So what used to be written as:
168
+
169
+ before_filter Proc { |controller| return false if controller.params["stop_action"] }
170
+
171
+ ...can now be as:
172
+
173
+ before_filter { |controller| return false if controller.params["stop_action"] }
174
+
175
+ [Jeremy Kemper]
176
+
177
+ * Made the following methods public (was protected): url_for, controller_class_name, controller_name, action_name
178
+ This makes it easier to write filters without cheating around the encapsulation with send.
179
+
180
+ * ActionController::Base#reset_session now sticks even if you access @session afterwards [Kent Sibilev]
181
+
182
+ * Improved the exception logging so the log file gets almost as much as in-browser debugging.
183
+
184
+ * Changed base class setup from AbstractTemplate/ERbTemplate to ActionView::Base. This change should be harmless unless you were
185
+ accessing Action View directly in which case you now need to reference the Base class.\
186
+
187
+ * Added that render_collection_of_partials returns nil if the collection is empty. This makes showing a “no items” message easier.
188
+ For example: <%= render_collection_of_partials("message", @messages) || "No messages found." %> [Sam Stephenson]
189
+
190
+ * Added :month_before_year as an option to date_select to get the month select before the year. Especially useful for credit card forms.
191
+
192
+ * Added :add_month_numbers to select_month to get options like "3 - March".
193
+
194
+ * Removed Base.has_active_layout? as it couldn't answer the question without the instance. Use Base#active_layout instead.
195
+
196
+ * Removed redundant call to update on ActionController::Base#close_session [Andreas Schwarz]
197
+
198
+ * Fixed that DRb Store accidently started its own server (instead of just client) [Andreas]
199
+
200
+ * Fixed strip_links so it now works across multiple lines [Chad Fowler]
201
+
202
+ * Fixed the TemplateError exception to show the proper trace on to_s (useful for unit test debugging)
203
+
204
+ * Implemented class inheritable attributes without eval [Caio Chassot]
205
+
206
+ * Made TextHelper#concat accept binding as it would otherwise not work
207
+
208
+ * The FormOptionsHelper will now call to_s on the keys and values used to generate options
209
+
210
+
211
+ *0.8.5*
212
+
213
+ * Introduced passing of locally scoped variables between templates:
214
+
215
+ You can pass local variables to sub templates by using a hash of with the variable
216
+ names as keys and the objects as values:
217
+
218
+ <%= render "shared/header", { "headline" => "Welcome", "person" => person } %>
219
+
220
+ These can now be accessed in shared/header with:
221
+
222
+ Headline: <%= headline %>
223
+ First name: <%= person.first_name %>
224
+
225
+ * Introduced the concept of partials as a certain type of sub templates:
226
+
227
+ There's also a convenience method for rendering sub templates within the current
228
+ controller that depends on a single object (we call this kind of sub templates for
229
+ partials). It relies on the fact that partials should follow the naming convention
230
+ of being prefixed with an underscore -- as to separate them from regular templates
231
+ that could be rendered on their own. In the template for Advertiser#buy, we could have:
232
+
233
+ <% for ad in @advertisements %>
234
+ <%= render_partial "ad", ad %>
235
+ <% end %>
236
+
237
+ This would render "advertiser/_ad.rhtml" and pass the local variable +ad+
238
+ for the template to display.
239
+
240
+ == Rendering a collection of partials
241
+
242
+ The example of partial use describes a familar pattern where a template needs
243
+ to iterate over a array and render a sub template for each of the elements.
244
+ This pattern has been implemented as a single method that accepts an array and
245
+ renders a partial by the same name of as the elements contained within. So the
246
+ three-lined example in "Using partials" can be rewritten with a single line:
247
+
248
+ <%= render_collection_of_partials "ad", @advertisements %>
249
+
250
+ So this will render "advertiser/_ad.rhtml" and pass the local variable +ad+ for
251
+ the template to display.
252
+
253
+ * Improved send_file by allowing a wide range of options to be applied [Jeremy Kemper]:
254
+
255
+ Sends the file by streaming it 4096 bytes at a time. This way the
256
+ whole file doesn't need to be read into memory at once. This makes
257
+ it feasible to send even large files.
258
+
259
+ Be careful to sanitize the path parameter if it coming from a web
260
+ page. send_file(@params['path'] allows a malicious user to
261
+ download any file on your server.
262
+
263
+ Options:
264
+ * <tt>:filename</tt> - specifies the filename the browser will see.
265
+ Defaults to File.basename(path).
266
+ * <tt>:type</tt> - specifies an HTTP content type.
267
+ Defaults to 'application/octet-stream'.
268
+ * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
269
+ Valid values are 'inline' and 'attachment' (default).
270
+ * <tt>:buffer_size</tt> - specifies size (in bytes) of the buffer used to stream
271
+ the file. Defaults to 4096.
272
+
273
+ The default Content-Type and Content-Disposition headers are
274
+ set to download arbitrary binary files in as many browsers as
275
+ possible. IE versions 4, 5, 5.5, and 6 are all known to have
276
+ a variety of quirks (especially when downloading over SSL).
277
+
278
+ Simple download:
279
+ send_file '/path/to.zip'
280
+
281
+ Show a JPEG in browser:
282
+ send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
283
+
284
+ Read about the other Content-* HTTP headers if you'd like to
285
+ provide the user with more information (such as Content-Description).
286
+ http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
287
+
288
+ Also be aware that the document may be cached by proxies and browsers.
289
+ The Pragma and Cache-Control headers declare how the file may be cached
290
+ by intermediaries. They default to require clients to validate with
291
+ the server before releasing cached responses. See
292
+ http://www.mnot.net/cache_docs/ for an overview of web caching and
293
+ http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
294
+ for the Cache-Control header spec.
295
+
296
+ * Added pluralize method to the TextHelper that makes it easy to get strings like "1 message", "3 messages"
297
+
298
+ * Added proper escaping for the rescues [Andreas Schwartz]
299
+
300
+ * Added proper escaping for the option and collection tags [Andreas Schwartz]
301
+
302
+ * Fixed NaN errors on benchmarking [Jim Weirich]
303
+
304
+ * Fixed query string parsing for URLs that use the escaped versions of & or ; as part of a key or value
305
+
306
+ * Fixed bug with custom Content-Type headers being in addition to rather than instead of the default header.
307
+ (This bug didn't matter with neither CGI or mod_ruby, but FCGI exploded on it) [With help from Ara T. Howard]
308
+
309
+
310
+ *0.8.0*
311
+
312
+ * Added select, collection_select, and country_select to make it easier for Active Records to set attributes through
313
+ drop-down lists of options. Example:
314
+
315
+ <%= select "person", "gender", %w( Male Female ) %>
316
+
317
+ ...would give the following:
318
+
319
+ <select name="person[gender]" id="person_gender"><option>Male</option><option>Female</option></select>
320
+
321
+ * Added an option for getting multiple values on a single form name into an array instead of having the last one overwrite.
322
+ This is especially useful for groups of checkboxes, which can now be written as:
323
+
324
+ <input type="checkbox" name="rights[]" value="CREATE" />
325
+ <input type="checkbox" name="rights[]" value="UPDATE" />
326
+ <input type="checkbox" name="rights[]" value="DELETE" />
327
+
328
+ ...and retrieved in the controller action with:
329
+
330
+ @params["rights"] # => [ "CREATE", "UPDATE", "DELETE" ]
331
+
332
+ The old behavior (where the last one wins, "DELETE" in the example) is still available. Just don't add "[]" to the
333
+ end of the name. [Scott Baron]
334
+
335
+ * Added send_file which uses the new render_text block acceptance to make it feasible to send large files.
336
+ The files is sent with a bunch of voodoo HTTP headers required to get arbitrary files to download as
337
+ expected in as many browsers as possible (eg, IE hacks). Example:
338
+
339
+ def play_movie
340
+ send_file "/movies/that_movie.avi"
341
+ end
342
+
343
+ [Jeremy Kemper]
344
+
345
+ * render_text now accepts a block for deferred rendering. Useful for streaming large files, displaying
346
+ a “please wait” message during a complex search, etc. Streaming example:
347
+
348
+ render_text do |response|
349
+ File.open(path, 'rb') do |file|
350
+ while buf = file.read(1024)
351
+ print buf
352
+ end
353
+ end
354
+ end
355
+
356
+ [Jeremy Kemper]
357
+
358
+ * Added a new Tag Helper that can generate generic tags programmatically insted of through HTML. Example:
359
+
360
+ tag("br", "clear" => "all") => <br clear="all" />
361
+
362
+ ...that's usually not terribly interesting (unless you have a lot of options already in a hash), but it
363
+ gives way for more specific tags, like the new form tag:
364
+
365
+ form_tag({ :controller => "weblog", :action => "update" }, { :multipart => "true", "style" => "width: 200px"}) =>
366
+ <form action="/weblog/update" enctype="multipart/formdata" style="width: 200px">
367
+
368
+ There's even a "pretty" version for people who don't like to open tags in code and close them in HTML:
369
+
370
+ <%= start_form_tag :action => "update" %>
371
+ # all the input fields
372
+ <%= end_form_tag %>
373
+
374
+ (end_form_tag just returns "</form>")
375
+
376
+ * The selected parameter in options_for_select may now also an array of values to be selected when
377
+ using a multiple select. Example:
378
+
379
+ options_for_select([ "VISA", "Mastercard", "Discover" ], ["VISA", "Discover"]) =>
380
+ <option selected>VISA</option>\n<option>Mastercard</option>\n<option selected>Discover</option>
381
+
382
+ [Scott Baron]
383
+
384
+ * Changed the URL rewriter so controller_prefix and action_prefix can be used in isolation. You can now do:
385
+
386
+ url_for(:controller_prefix => "clients")
387
+
388
+ ...or:
389
+
390
+ url_for(:action_prefix => "category/messages")
391
+
392
+ Neither would have worked in isolation before (:controller_prefix required a :controller and :action_prefix required an :action)
393
+
394
+ * Started process of a cleaner separation between Action Controller and ERb-based Action Views by introducing an
395
+ abstract base class for views. And Amita adapter could be fitted in more easily now.
396
+
397
+ * The date helper methods date_select and datetime_select now also use the field error wrapping
398
+ (div with class fieldWithErrors by default).
399
+
400
+ * The date helper methods date_select and datetime_select can now discard selects
401
+
402
+ * Added option on AbstractTemplate to specify a different field error wrapping. Example:
403
+
404
+ ActionView::AbstractTemplate.field_error_proc = Proc.new do |html, instance|
405
+ "<p>#{instance.method_name + instance.error_message}</p><div style='background-color: red'>#{html}</div>"
406
+ end
407
+
408
+ ...would give the following on a Post#title (text field) error:
409
+
410
+ <p>Title can't be empty</p>
411
+ <div style='background-color: red'>
412
+ <input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />
413
+ </div>
414
+
415
+ * The UrlHelper methods url_for and link_to will now by default only return paths, not complete URIs.
416
+ That should make it easier to fit a Rails application behind a proxy or load-balancer.
417
+ You can overwrite this by passing :only_path => false as part of the options. [Suggested by U235]
418
+
419
+ * Fixed bug with having your own layout for use with scaffolding [Kevin Radloff]
420
+
421
+ * Fixed bug where redirect_to_path didn't append the port on non-standard ports [dhawkins]
422
+
423
+ * Scaffolding plays nicely with single-table inheritance (LoadErrors are caught) [Jeremy Kemper]
424
+
425
+ * Scaffolding plays nice with plural models like Category/categories [Jeremy Kemper]
426
+
427
+ * Fixed missing suffix appending in scaffolding [Kevin Radloff]
428
+
429
+
430
+ *0.7.9*
431
+
432
+ * The "form" method now present boolean fields from PostgreSQL as drop-down menu. [Scott]
433
+
434
+ * Scaffolding now automatically attempts to require the class that's being scaffolded.
435
+
436
+ * Scaffolding will use the current active layout, instead of its own, if one has been specified. Example:
437
+
438
+ class WeblogController < ActionController::Base
439
+ layout "layouts/weblog"
440
+ scaffold :post
441
+ end
442
+
443
+ [Suggested by Scott]
444
+
445
+ * 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.
446
+ This symbol is a method reference which is then called to calculate the url. Example:
447
+
448
+ class WeblogController < ActionController::Base
449
+ def update
450
+ # do some update
451
+ redirect_to :dashboard_url
452
+ end
453
+
454
+ protected
455
+ def dashboard_url
456
+ if @project.active?
457
+ url_for :controller => "project", :action => "dashboard"
458
+ else
459
+ url_for :controller => "account", :action => "dashboard"
460
+ end
461
+ end
462
+ end
463
+
464
+ * Added default_url_options to specialize behavior for all url_for (and friends) calls:
465
+
466
+ Overwrite to implement a number of default options that all url_for-based methods will use.
467
+ The default options should come in form of a hash, just like the one you would use for
468
+ url_for directly. Example:
469
+
470
+ def default_url_options(options)
471
+ { :controller_prefix => @project.active? ? "projects/" : "accounts/" }
472
+ end
473
+
474
+ As you can infer from the example, this is mostly useful for situations where you want to
475
+ centralize dynamic dissions about the urls as they stem from the business domain. Please note
476
+ that any individual url_for call can always override the defaults set by this method.
477
+
478
+
479
+ * Changed url_for so that an "id" passed in the :params is not treated special. You need to use the dedicated :id to get
480
+ the special auto path-params treatment. Considering the url http://localhost:81/friends/list
481
+
482
+ url_for(:action => "show", :params => { "id" => 5 })
483
+ ...used to give http://localhost:81/friends/show/5
484
+ ......now gives http://localhost:81/friends/show?id=5
485
+
486
+ If you want the automated id behavior, do:
487
+
488
+ url_for(:action => "show", :id => 5 )
489
+ ....which gives http://localhost:81/friends/show/5
490
+
491
+
492
+ * Fixed problem with anchor being inserted before path parameters with url_for (and friends)
493
+
494
+
495
+ *0.7.8*
496
+
497
+ * Fixed session bug where you couldn't store any objects that didn't exist in the standard library
498
+ (such as Active Record objects).
499
+
500
+ * Added reset_session method for Action Controller objects to clear out all objects in the session.
501
+
502
+ * Fixed that exceptions raised during filters are now also caught by the default rescues
503
+
504
+ * Added new around_filter for doing before and after filtering with a single object [Florian Weber]:
505
+
506
+ class WeblogController < ActionController::Base
507
+ around_filter BenchmarkingFilter.new
508
+
509
+ # Before this action is performed, BenchmarkingFilter#before(controller) is executed
510
+ def index
511
+ end
512
+ # After this action has been performed, BenchmarkingFilter#after(controller) is executed
513
+ end
514
+
515
+ class BenchmarkingFilter
516
+ def initialize
517
+ @runtime
518
+ end
519
+
520
+ def before
521
+ start_timer
522
+ end
523
+
524
+ def after
525
+ stop_timer
526
+ report_result
527
+ end
528
+ end
529
+
530
+ * Added the options for specifying a different name and id for the form helper methods than what is guessed [Florian Weber]:
531
+
532
+ text_field "post", "title"
533
+ ...just gives: <input id="post_title" name="post[title]" size="30" type="text" value="" />
534
+
535
+ text_field "post", "title", "id" => "title_for_post", "name" => "first_post_title"
536
+ ...can now give: <input id="title_for_post" name="first_post_title" size="30" type="text" value="" />
537
+
538
+ * Added DebugHelper with a single "debug" method for doing pretty dumps of objects in the view
539
+ (now used in the default rescues to better present the contents of session and template variables)
540
+
541
+ * Added note to log about the templates rendered within layouts (before just the layout was shown)
542
+
543
+ * Fixed redirects on https setups [Andreas]
544
+
545
+ * Fixed scaffolding problem on the edit action when using :suffix => true [Scott]
546
+
547
+ * Fixed scaffolding problem where implementing list.rhtml wouldn't work for the index action
548
+
549
+ * URLs generated now uses &amp; instead of just & so pages using it can validate with W3C [Spotted by Andreas]
550
+
551
+
552
+ *0.7.7*
553
+
554
+ * Fixed bug in CGI extension that prevented multipart forms from working
555
+
556
+
557
+ *0.7.6*
558
+
559
+ * Included ERB::Util so all templates can easily escape HTML content with <%=h @person.content %>
560
+
561
+ * All requests are now considered local by default, so everyone will be exposed to detailed debugging screens on errors.
562
+ When the application is ready to go public, set ActionController::Base.consider_all_requests_local to false,
563
+ and implement the protected method local_request? in the controller to determine when debugging screens should be shown.
564
+
565
+ * Fixed three bugs with the url_for/redirect_to/link_to handling. Considering the url http://localhost:81/friends/show/1
566
+
567
+ url_for(:action => "list")
568
+ ...used to give http://localhost:81/friends/list/1
569
+ ......now gives http://localhost:81/friends/list
570
+
571
+ url_for(:controller => "friends", :action => "destroy", :id => 5)
572
+ ...used to give http://localhost:81/friends/destroy
573
+ ......now gives http://localhost:81/friends/destroy/5
574
+
575
+ Considering the url http://localhost:81/teachers/show/t
576
+
577
+ url_for(:action => "list", :id => 5)
578
+ ...used to give http://localhost:81/5eachers/list/t
579
+ ......now gives http://localhost:81/teachers/list/5
580
+
581
+ [Reported by David Morton & Radsaq]
582
+
583
+ * Logs exception to logfile in addition to showing them for local requests
584
+
585
+ * Protects the eruby load behind a begin/rescue block. eRuby is not required to run ActionController.
586
+
587
+ * Fixed install.rb to also install clean_logger and the templates
588
+
589
+ * Added ActiveRecordStore as a session option. Read more in lib/action_controller/session/active_record_store.rb [Tim Bates]
590
+
591
+ * Change license to MIT License (and included license file in package)
592
+
593
+ * Application error page now returns status code 500 instead of 200
594
+
595
+ * Fixed using Procs as layout handlers [Florian Weber]
596
+
597
+ * Fixed bug with using redirects ports other than 80
598
+
599
+ * Added index method that calls list on scaffolding
600
+
601
+
602
+ *0.7.5*
603
+
604
+ * First public release