actionpack 1.10.2 → 1.11.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 (43) hide show
  1. data/CHANGELOG +57 -3
  2. data/README +7 -7
  3. data/lib/action_controller/assertions.rb +28 -11
  4. data/lib/action_controller/base.rb +22 -15
  5. data/lib/action_controller/caching.rb +6 -6
  6. data/lib/action_controller/components.rb +1 -1
  7. data/lib/action_controller/cookies.rb +3 -3
  8. data/lib/action_controller/dependencies.rb +1 -1
  9. data/lib/action_controller/filters.rb +40 -3
  10. data/lib/action_controller/flash.rb +4 -0
  11. data/lib/action_controller/helpers.rb +1 -1
  12. data/lib/action_controller/layout.rb +2 -1
  13. data/lib/action_controller/pagination.rb +2 -1
  14. data/lib/action_controller/rescue.rb +1 -1
  15. data/lib/action_controller/session/active_record_store.rb +18 -29
  16. data/lib/action_controller/templates/rescues/_trace.rhtml +0 -3
  17. data/lib/action_controller/templates/scaffolds/layout.rhtml +1 -1
  18. data/lib/action_controller/vendor/html-scanner/html/document.rb +2 -2
  19. data/lib/action_pack.rb +24 -0
  20. data/lib/action_pack/version.rb +2 -2
  21. data/lib/action_view/base.rb +1 -1
  22. data/lib/action_view/helpers/asset_tag_helper.rb +21 -3
  23. data/lib/action_view/helpers/form_options_helper.rb +1 -1
  24. data/lib/action_view/helpers/javascript_helper.rb +1 -0
  25. data/lib/action_view/helpers/javascripts/controls.js +18 -5
  26. data/lib/action_view/helpers/javascripts/dragdrop.js +6 -3
  27. data/lib/action_view/helpers/javascripts/effects.js +181 -290
  28. data/lib/action_view/helpers/javascripts/prototype.js +8 -8
  29. data/lib/action_view/helpers/text_helper.rb +22 -0
  30. data/lib/action_view/helpers/url_helper.rb +1 -1
  31. data/lib/action_view/template_error.rb +2 -1
  32. data/rakefile +1 -1
  33. data/test/controller/components_test.rb +5 -0
  34. data/test/controller/filters_test.rb +2 -1
  35. data/test/controller/flash_test.rb +6 -0
  36. data/test/controller/new_render_test.rb +11 -0
  37. data/test/controller/redirect_test.rb +10 -0
  38. data/test/fixtures/layouts/standard.rhtml +1 -1
  39. data/test/template/asset_tag_helper_test.rb +19 -2
  40. data/test/template/javascript_helper_test.rb +1 -0
  41. data/test/template/text_helper_test.rb +9 -0
  42. metadata +5 -4
  43. data/lib/action_view/helpers/javascripts/slider.js +0 -258
data/CHANGELOG CHANGED
@@ -1,3 +1,57 @@
1
+ *1.11.0* (November 7th, 2005)
2
+
3
+ * Added request as instance method to views, so you can do <%= request.env["HTTP_REFERER"] %>, just like you can already access response, session, and the likes [DHH]
4
+
5
+ * Fix conflict with assert_tag and Glue gem #2255 [david.felstead@gmail.com]
6
+
7
+ * Add documentation to assert_tag indicating that it only works with well-formed XHTML #1937, #2570 [Jamis Buck]
8
+
9
+ * Added action_pack.rb stub so that ActionPack::Version loads properly [Sam Stephenson]
10
+
11
+ * Added short-hand to assert_tag so assert_tag :tag => "span" can be written as assert_tag "span" [DHH]
12
+
13
+ * Added skip_before_filter/skip_after_filter for easier control of the filter chain in inheritance hierachies [DHH]. Example:
14
+
15
+ class ApplicationController < ActionController::Base
16
+ before_filter :authenticate
17
+ end
18
+
19
+ class WeblogController < ApplicationController
20
+ # will run the :authenticate filter
21
+ end
22
+
23
+ class SignupController < ActionController::Base
24
+ # will not run the :authenticate filter
25
+ skip_before_filter :authenticate
26
+ end
27
+
28
+ * Added redirect_to :back as a short-hand for redirect_to(request.env["HTTP_REFERER"]) [DHH]
29
+
30
+ * Change javascript_include_tag :defaults to not use script.aculo.us loader, which facilitates the use of plugins for future script.aculo.us and third party javascript extensions, and provide register_javascript_include_default for plugins to specify additional JavaScript files to load. Removed slider.js and builder.js from actionpack. [Thomas Fuchs]
31
+
32
+ * Fix problem where redirecting components can cause an infinite loop [Rick Olson]
33
+
34
+ * Added support for the queue option on visual_effect [Thomas Fuchs]
35
+
36
+ * Update script.aculo.us to V1.5_rc4 [Thomas Fuchs]
37
+
38
+ * Fix that render :text didn't interpolate instance variables #2629, #2626 [skaes]
39
+
40
+ * Fix line number detection and escape RAILS_ROOT in backtrace Regexp [Nicholas Seckar]
41
+
42
+ * Fixed document.getElementsByClassName from Prototype to be speedy again [Sam Stephenson]
43
+
44
+ * Recognize ./#{RAILS_ROOT} as RAILS_ROOT in error traces [Nicholas Seckar]
45
+
46
+ * Remove ARStore session fingerprinting [Nicholas Seckar]
47
+
48
+ * Fix obscure bug in ARStore [Nicholas Seckar]
49
+
50
+ * Added TextHelper#strip_tags for removing HTML tags from a string (using HTMLTokenizer) #2229 [marcin@junkheap.net]
51
+
52
+ * Added a reader for flash.now, so it's possible to do stuff like flash.now[:alert] ||= 'New if not set' #2422 [Caio Chassot]
53
+
54
+
1
55
  *1.10.2* (October 26th, 2005)
2
56
 
3
57
  * Reset template variables after using render_to_string [skaes@web.de]
@@ -519,7 +573,7 @@
519
573
 
520
574
  * Added ActionController::Base.asset_host that will then be used by all the asset helpers. This enables you to easily offload static content like javascripts and images to a separate server tuned just for that.
521
575
 
522
- * Fixed action/fragment caching using the filestore when a directory and a file wanted to to use the same name. Now there's a .cache prefix that sidesteps the conflict #1188 [imbcmdth@hotmail.com]
576
+ * Fixed action/fragment caching using the filestore when a directory and a file wanted to use the same name. Now there's a .cache prefix that sidesteps the conflict #1188 [imbcmdth@hotmail.com]
523
577
 
524
578
  * Fixed missing id uniqueness in FormTag#radio_button #1207 [Jarkko]
525
579
 
@@ -1127,7 +1181,7 @@
1127
1181
 
1128
1182
  * Added POST support for the breakpoint retries, so form processing that raises an exception can be retried with the original request [Florian Gross]
1129
1183
 
1130
- * Fixed regression with Base#reset_session that wouldn't use the the DEFAULT_SESSION_OPTIONS [adam@the-kramers.net]
1184
+ * Fixed regression with Base#reset_session that wouldn't use the DEFAULT_SESSION_OPTIONS [adam@the-kramers.net]
1131
1185
 
1132
1186
  * Fixed error rendering of rxml documents to not just swallow the exception and return 0 (still not guessing the right line, but hey)
1133
1187
 
@@ -1379,7 +1433,7 @@
1379
1433
  * Added another case to DateHelper#distance_in_minutes to return "less than a minute" instead of "0 minutes" and "1 minute" instead of "1 minutes"
1380
1434
 
1381
1435
  * Added a hidden field to checkboxes generated with FormHelper#check_box that will make sure that the unchecked value (usually 0)
1382
- is sent even if the checkbox is not checked. This relieves the controller from doing custom checking if the the checkbox wasn't
1436
+ is sent even if the checkbox is not checked. This relieves the controller from doing custom checking if the checkbox wasn't
1383
1437
  checked. BEWARE: This might conflict with your run-on-the-mill work-around code. [Tobias Luetke]
1384
1438
 
1385
1439
  * Fixed error_message_on to just use the first if more than one error had been added [marcel]
data/README CHANGED
@@ -24,14 +24,14 @@ ActiveRecord[http://activerecord.rubyonrails.org] (an object-relational
24
24
  mapping package), but that doesn't mean that Action Pack depends on Active
25
25
  Record. Action Pack is an independent package that can be used with any sort
26
26
  of backend (Instiki[http://www.instiki.org], which is based on an older version
27
- of Action Pack, uses Madeleine for example). Read more about the role Action
27
+ of Action Pack, used Madeleine for example). Read more about the role Action
28
28
  Pack can play when used together with Active Record on
29
29
  http://www.rubyonrails.org.
30
30
 
31
31
  A short rundown of the major features:
32
32
 
33
33
  * Actions grouped in controller as methods instead of separate command objects
34
- and can therefore helper share methods.
34
+ and can therefore share helper methods.
35
35
 
36
36
  BlogController < ActionController::Base
37
37
  def display
@@ -103,15 +103,15 @@ A short rundown of the major features:
103
103
  def list
104
104
  # Before this action is run, the user will be authenticated, the cache
105
105
  # will be examined to see if a valid copy of the results already
106
- # exist, and the action will be logged for auditing.
106
+ # exists, and the action will be logged for auditing.
107
107
 
108
108
  # After this action has run, the output will first be localized then
109
- # compressed to minimize bandwith usage
109
+ # compressed to minimize bandwidth usage
110
110
  end
111
111
 
112
112
  private
113
113
  def authenticate
114
- # Implement the filter will full access to both request and response
114
+ # Implement the filter with full access to both request and response
115
115
  end
116
116
  end
117
117
 
@@ -316,7 +316,7 @@ A short rundown of the major features:
316
316
 
317
317
  <%= form "post" %>
318
318
 
319
- ...will generate something like (the selects will have more options of
319
+ ...will generate something like (the selects will have more options, of
320
320
  course):
321
321
 
322
322
  <form action="create" method="POST">
@@ -413,7 +413,7 @@ And the templates look like this:
413
413
 
414
414
  This simple setup will list all the posts in the system on the index page,
415
415
  which is called by accessing /weblog/. It uses the form builder for the Active
416
- Record model to make the new screen, which in turns hand everything over to
416
+ Record model to make the new screen, which in turn hands everything over to
417
417
  the create action (that's the default target for the form builder when given a
418
418
  new model). After creating the post, it'll redirect to the display page using
419
419
  an URL such as /weblog/display/5 (where 5 is the id of the post).
@@ -8,9 +8,9 @@ module Test #:nodoc:
8
8
  # In addition to these specific assertions, you also have easy access to various collections that the regular test/unit assertions
9
9
  # can be used against. These collections are:
10
10
  #
11
- # * assigns: Instance variables assigned in the action that's available for the view.
11
+ # * assigns: Instance variables assigned in the action that are available for the view.
12
12
  # * session: Objects being saved in the session.
13
- # * flash: The flash objects being currently in the session.
13
+ # * flash: The flash objects currently in the session.
14
14
  # * cookies: Cookies being sent to the user on this request.
15
15
  #
16
16
  # These collections can be used just like any other hash:
@@ -25,13 +25,13 @@ module Test #:nodoc:
25
25
  #
26
26
  # On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url.
27
27
  #
28
- # For redirects within the same controller, you can even call follow_redirect and the redirect will be follow triggering another
28
+ # For redirects within the same controller, you can even call follow_redirect and the redirect will be followed, triggering another
29
29
  # action call which can then be asserted against.
30
30
  #
31
31
  # == Manipulating the request collections
32
32
  #
33
- # The collections described above link to the response, so you can test if what the actions were expected to do happen. But
34
- # some times you also want to manipulate these collections in the request coming in. This is really only relevant for sessions
33
+ # The collections described above link to the response, so you can test if what the actions were expected to do happened. But
34
+ # sometimes you also want to manipulate these collections in the incoming request. This is really only relevant for sessions
35
35
  # and cookies, though. For sessions, you just do:
36
36
  #
37
37
  # @request.session[:key] = "value"
@@ -68,7 +68,7 @@ module Test #:nodoc:
68
68
  end
69
69
 
70
70
  # Assert that the redirection options passed in match those of the redirect called in the latest action. This match can be partial,
71
- # such at assert_redirected_to(:controller => "weblog") will also match the redirection of
71
+ # such that assert_redirected_to(:controller => "weblog") will also match the redirection of
72
72
  # redirect_to(:controller => "weblog", :action => "show") and so on.
73
73
  def assert_redirected_to(options = {}, message=nil)
74
74
  clean_backtrace do
@@ -118,7 +118,7 @@ module Test #:nodoc:
118
118
  end
119
119
  end
120
120
 
121
- # Asserts that the routing of the given path is handled correctly and that the parsed options match.
121
+ # Asserts that the routing of the given path was handled correctly and that the parsed options match.
122
122
  def assert_recognizes(expected_options, path, extras={}, message=nil)
123
123
  clean_backtrace do
124
124
  path = "/#{path}" unless path[0..0] == '/'
@@ -159,8 +159,8 @@ module Test #:nodoc:
159
159
  end
160
160
  end
161
161
 
162
- # asserts that path and options match both ways, in other words, the URL generated from
163
- # options is same as path, and also that the options recognized from path are same as options
162
+ # Asserts that path and options match both ways; in other words, the URL generated from
163
+ # options is the same as path, and also that the options recognized from path are the same as options
164
164
  def assert_routing(path, options, defaults={}, extras={}, message=nil)
165
165
  assert_recognizes(options, path, extras, message)
166
166
 
@@ -221,6 +221,15 @@ module Test #:nodoc:
221
221
  # # assert that there is a "span" tag
222
222
  # assert_tag :tag => "span"
223
223
  #
224
+ # # assert that there is a "span" tag with id="x"
225
+ # assert_tag :tag => "span", :attributes => { :id => "x" }
226
+ #
227
+ # # assert that there is a "span" tag using the short-hand
228
+ # assert_tag :span
229
+ #
230
+ # # assert that there is a "span" tag with id="x" using the short-hand
231
+ # assert_tag :span, :attributes => { :id => "x" }
232
+ #
224
233
  # # assert that there is a "span" inside of a "div"
225
234
  # assert_tag :tag => "span", :parent => { :tag => "div" }
226
235
  #
@@ -248,8 +257,15 @@ module Test #:nodoc:
248
257
  # :attributes => { :class => "enum" } },
249
258
  # :descendant => { :tag => "span",
250
259
  # :child => /hello world/ }
251
- def assert_tag(opts)
260
+ #
261
+ # <strong>Please note</strong: #assert_tag and #assert_no_tag only work
262
+ # with well-formed XHTML. They recognize a few tags as implicitly self-closing
263
+ # (like br and hr and such) but will not work correctly with tags
264
+ # that allow optional closing tags (p, li, td). <em>You must explicitly
265
+ # close all of your tags to use these assertions.</em>
266
+ def assert_tag(*opts)
252
267
  clean_backtrace do
268
+ opts = opts.size > 1 ? opts.last.merge({ :tag => opts.first.to_s }) : opts.first
253
269
  tag = find_tag(opts)
254
270
  assert tag, "expected tag, but no tag found matching #{opts.inspect} in:\n#{@response.body.inspect}"
255
271
  end
@@ -257,8 +273,9 @@ module Test #:nodoc:
257
273
 
258
274
  # Identical to #assert_tag, but asserts that a matching tag does _not_
259
275
  # exist. (See #assert_tag for a full discussion of the syntax.)
260
- def assert_no_tag(opts)
276
+ def assert_no_tag(*opts)
261
277
  clean_backtrace do
278
+ opts = opts.size > 1 ? opts.last.merge({ :tag => opts.first.to_s }) : opts.first
262
279
  tag = find_tag(opts)
263
280
  assert !tag, "expected no tag, but found tag matching #{opts.inspect} in:\n#{@response.body.inspect}"
264
281
  end
@@ -89,7 +89,7 @@ module ActionController #:nodoc:
89
89
  #
90
90
  # == Parameters
91
91
  #
92
- # All request parameters whether they come from a GET or POST request, or from the URL, are available through the params hash.
92
+ # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params hash.
93
93
  # So an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 }
94
94
  # in params.
95
95
  #
@@ -165,7 +165,7 @@ module ActionController #:nodoc:
165
165
  # the post again, but rather just show it one more time.
166
166
  #
167
167
  # This sounds fairly simple, but the redirection is complicated by the quest for a phenomenon known as "pretty urls". Instead of accepting
168
- # the dreadful beings that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as
168
+ # the dreadful being that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as
169
169
  # "/weblog/show/5". And this is even the simple case. As an example of a more advanced pretty url consider
170
170
  # "/library/books/ISBN/0743536703/show", which can be mapped to books_controller?action=show&type=ISBN&id=0743536703.
171
171
  #
@@ -188,7 +188,7 @@ module ActionController #:nodoc:
188
188
  #
189
189
  # == Calling multiple redirects or renders
190
190
  #
191
- # An action should conclude by a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError:
191
+ # An action should conclude with a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError:
192
192
  #
193
193
  # def do_something
194
194
  # redirect_to :action => "elsewhere"
@@ -241,7 +241,7 @@ module ActionController #:nodoc:
241
241
  @@debug_routes = true
242
242
  cattr_accessor :debug_routes
243
243
 
244
- # Controls whether the application is thread-safe, so multi-threaded servers like WEBrick knows whether to apply a mutex
244
+ # Controls whether the application is thread-safe, so multi-threaded servers like WEBrick know whether to apply a mutex
245
245
  # around the performance of each action. Action Pack and Active Record are by default thread-safe, but many applications
246
246
  # may not be. Turned off by default.
247
247
  @@allow_concurrency = false
@@ -276,7 +276,7 @@ module ActionController #:nodoc:
276
276
  attr_accessor :response
277
277
 
278
278
  # Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person"
279
- # key. The session will hold any type of object as values, but the key should be a string.
279
+ # key. The session will hold any type of object as values, but the key should be a string or symbol.
280
280
  attr_accessor :session
281
281
 
282
282
  # Holds a hash of header names and values. Accessed like <tt>headers["Cache-Control"]</tt> to get the value of the Cache-Control
@@ -306,7 +306,7 @@ module ActionController #:nodoc:
306
306
  @controller_name ||= controller_class_name.sub(/Controller$/, '').underscore
307
307
  end
308
308
 
309
- # Convert the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
309
+ # Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
310
310
  def controller_path
311
311
  unless @controller_path
312
312
  components = self.name.to_s.split('::')
@@ -363,9 +363,9 @@ module ActionController #:nodoc:
363
363
 
364
364
  log_processing if logger
365
365
  send(method, *arguments)
366
- close_session
367
-
368
366
  @response
367
+ ensure
368
+ close_session
369
369
  end
370
370
 
371
371
  # Returns a URL that has been rewritten according to the options hash and the defined Routes.
@@ -373,7 +373,7 @@ module ActionController #:nodoc:
373
373
  # �
374
374
  # <tt>url_for</tt> is used to:
375
375
  # �
376
- # All keys given to url_for are forwarded to the Route module save for the following:
376
+ # All keys given to url_for are forwarded to the Route module, save for the following:
377
377
  # * <tt>:anchor</tt> -- specifies the anchor name to be appended to the path. For example,
378
378
  # <tt>url_for :controller => 'posts', :action => 'show', :id => 10, :anchor => 'comments'</tt>
379
379
  # will produce "/posts/show/10#comments".
@@ -408,7 +408,7 @@ module ActionController #:nodoc:
408
408
  # The final rule is applied while the URL is being generated and is best illustrated by an example. Let us consider the
409
409
  # route given by <tt>map.connect 'people/:last/:first/:action', :action => 'bio', :controller => 'people'</tt>.
410
410
  #
411
- # Suppose that the current URL is "people/hh/david/contacts". Let's consider a few different cases URLs which are generated
411
+ # Suppose that the current URL is "people/hh/david/contacts". Let's consider a few different cases of URLs which are generated
412
412
  # from this page.
413
413
  #
414
414
  # * <tt>url_for :action => 'bio'</tt> -- During the generation of this URL, default values will be used for the first and
@@ -436,7 +436,7 @@ module ActionController #:nodoc:
436
436
  # url_for :overwrite_params => { :action => 'print' }
437
437
  #
438
438
  # This takes the current URL as is and only exchanges the action. In contrast, <tt>url_for :action => 'print'</tt>
439
- # would have slashed-off the path components are the changed action.
439
+ # would have slashed-off the path components after the changed action.
440
440
  def url_for(options = {}, *parameters_for_method_reference) #:doc:
441
441
  case options
442
442
  when String then options
@@ -481,7 +481,7 @@ module ActionController #:nodoc:
481
481
  #
482
482
  # === Rendering partials
483
483
  #
484
- # Partial rendering is most commonly used together with Ajax calls that only updates one or a few elements on a page
484
+ # Partial rendering is most commonly used together with Ajax calls that only update one or a few elements on a page
485
485
  # without reloading. Rendering of partials from the controller makes it possible to use the same partial template in
486
486
  # both the full-page rendering (by calling it from within the template) and when sub-page updates happen (from the
487
487
  # controller action responding to Ajax calls). By default, the current layout is not used.
@@ -542,7 +542,7 @@ module ActionController #:nodoc:
542
542
  # # Renders the clear text "Hi there!" within the current active layout (if one exists)
543
543
  # render :text => "Explosion!", :layout => true
544
544
  #
545
- # # Renders the clear text "Hi there!" within the the layout
545
+ # # Renders the clear text "Hi there!" within the layout
546
546
  # # placed in "app/views/layouts/special.r(html|xml)"
547
547
  # render :text => "Explosion!", :layout => "special"
548
548
  #
@@ -683,7 +683,7 @@ module ActionController #:nodoc:
683
683
  @performed_render = false
684
684
  end
685
685
 
686
- # Clears the redirected results from the headers, resetting the status to 200 and returns
686
+ # Clears the redirected results from the headers, resets the status to 200 and returns
687
687
  # the URL that was used to redirect or nil if there was no redirected URL
688
688
  # Note that +redirect_to+ will change the body of the response to indicate a redirection.
689
689
  # The response body is not reset here, see +erase_render_results+
@@ -726,12 +726,15 @@ module ActionController #:nodoc:
726
726
  #
727
727
  # * <tt>Hash</tt>: The URL will be generated by calling url_for with the +options+.
728
728
  # * <tt>String starting with protocol:// (like http://)</tt>: Is passed straight through as the target for redirection.
729
- # * <tt>String not containing a protocol</tt>: The current current protocol and host is prepended to the string.
729
+ # * <tt>String not containing a protocol</tt>: The current protocol and host is prepended to the string.
730
+ # * <tt>:back</tt>: Back to the page that issued the request. Useful for forms that are triggered from multiple places.
731
+ # Short-hand for redirect_to(request.env["HTTP_REFERER"])
730
732
  #
731
733
  # Examples:
732
734
  # redirect_to :action => "show", :id => 5
733
735
  # redirect_to "http://www.rubyonrails.org"
734
736
  # redirect_to "/images/screenshot.jpg"
737
+ # redirect_to :back
735
738
  #
736
739
  # The redirection happens as a "302 Moved" header.
737
740
  def redirect_to(options = {}, *parameters_for_method_reference) #:doc:
@@ -745,6 +748,9 @@ module ActionController #:nodoc:
745
748
 
746
749
  when String
747
750
  redirect_to(request.protocol + request.host_with_port + options)
751
+
752
+ when :back
753
+ redirect_to(request.env["HTTP_REFERER"])
748
754
 
749
755
  else
750
756
  if parameters_for_method_reference.empty?
@@ -805,6 +811,7 @@ module ActionController #:nodoc:
805
811
  raise "You must assign a template class through ActionController.template_class= before processing a request" unless @@template_class
806
812
 
807
813
  response.template = self.class.view_class.new(self.class.view_root, {}, self)
814
+ response.redirected_to = nil
808
815
  @performed_render = @performed_redirect = false
809
816
  end
810
817
 
@@ -18,7 +18,7 @@ module ActionController #:nodoc:
18
18
  end
19
19
 
20
20
  # Page caching is an approach to caching where the entire action output of is stored as a HTML file that the web server
21
- # can serve without going through the Action Pack. This can be as much as 100 times faster than going the process of dynamically
21
+ # can serve without going through the Action Pack. This can be as much as 100 times faster than going through the process of dynamically
22
22
  # generating the content. Unfortunately, this incredible speed-up is only available to stateless pages where all visitors
23
23
  # are treated the same. Content management systems -- including weblogs and wikis -- have many pages that are a great fit
24
24
  # for this approach, but account-based systems where people log in and manipulate their own data are often less likely candidates.
@@ -140,7 +140,7 @@ module ActionController #:nodoc:
140
140
 
141
141
  # Action caching is similar to page caching by the fact that the entire output of the response is cached, but unlike page caching,
142
142
  # every request still goes through the Action Pack. The key benefit of this is that filters are run before the cache is served, which
143
- # allows for authentication and other restrictions on whether someone are supposed to see the cache. Example:
143
+ # allows for authentication and other restrictions on whether someone is allowed to see the cache. Example:
144
144
  #
145
145
  # class ListsController < ApplicationController
146
146
  # before_filter :authenticate, :except => :public
@@ -228,7 +228,7 @@ module ActionController #:nodoc:
228
228
  # In order to use the fragment caching, you need to designate where the caches should be stored. This is done by assigning a fragment store
229
229
  # of which there are four different kinds:
230
230
  #
231
- # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and share the fragments for
231
+ # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and shares the fragments for
232
232
  # all the web server processes running off the same application directory.
233
233
  # * MemoryStore: Keeps the fragments in memory, which is fine for WEBrick and for FCGI (if you don't care that each FCGI process holds its
234
234
  # own fragment store). It's not suitable for CGI as the process is thrown away at the end of each request. It can potentially also take
@@ -256,7 +256,7 @@ module ActionController #:nodoc:
256
256
  @@fragment_cache_store = if store.is_a?(Symbol)
257
257
  store_class_name = (store == :drb_store ? "DRbStore" : store.to_s.camelize)
258
258
  store_class = ActionController::Caching::Fragments.const_get(store_class_name)
259
- parameters.empty? ? store.new : store_class.new(*parameters)
259
+ store_class.new(*parameters)
260
260
  else
261
261
  store
262
262
  end
@@ -481,14 +481,14 @@ module ActionController #:nodoc:
481
481
  # end
482
482
  # end
483
483
  #
484
- # The sweeper is assigned on the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method:
484
+ # The sweeper is assigned in the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method:
485
485
  #
486
486
  # class ListsController < ApplicationController
487
487
  # caches_action :index, :show, :public, :feed
488
488
  # cache_sweeper :list_sweeper, :only => [ :edit, :destroy, :share ]
489
489
  # end
490
490
  #
491
- # In the example above, four actions are cached and three actions are responsible of expiring those caches.
491
+ # In the example above, four actions are cached and three actions are responsible for expiring those caches.
492
492
  module Sweeping
493
493
  def self.append_features(base) #:nodoc:
494
494
  super
@@ -1,5 +1,5 @@
1
1
  module ActionController #:nodoc:
2
- # Components allows you to call other actions for their rendered response while execution another action. You can either delegate
2
+ # Components allows you to call other actions for their rendered response while executing another action. You can either delegate
3
3
  # the entire response rendering or you can mix a partial response in with your other content.
4
4
  #
5
5
  # class WeblogController < ActionController::Base
@@ -1,6 +1,6 @@
1
1
  module ActionController #:nodoc:
2
- # Cookies are read and written through ActionController#cookies. The cookies being read is what was received along with the request,
3
- # the cookies being written is what will be sent out will the response. Cookies are read by value (so you won't get the cookie object
2
+ # Cookies are read and written through ActionController#cookies. The cookies being read are what were received along with the request,
3
+ # the cookies being written are what will be sent out with the response. Cookies are read by value (so you won't get the cookie object
4
4
  # itself back -- just the value it holds). Examples for writing:
5
5
  #
6
6
  # cookies[:user_name] = "david" # => Will set a simple session cookie
@@ -43,7 +43,7 @@ module ActionController #:nodoc:
43
43
  update(@cookies)
44
44
  end
45
45
 
46
- # Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method
46
+ # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using either the cookie method
47
47
  # or cookies[]= (for simple name/value cookies without options).
48
48
  def [](name)
49
49
  @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value)