Commit Graph

121 Commits

Author SHA1 Message Date
David Lee
002713c645 Add config.default_method_for_update to support PATCH
PATCH is the correct HTML verb to map to the #update action. The
semantics for PATCH allows for partial updates, whereas PUT requires a
complete replacement.

Changes:
* adds config.default_method_for_update you can set to :patch
* optionally use PATCH instead of PUT in resource routes and forms
* adds the #patch verb to routes to detect PATCH requests
* adds #patch? to Request
* changes documentation and comments to indicate support for PATCH

This change maintains complete backwards compatibility by keeping :put
as the default for config.default_method_for_update.
2012-02-22 08:47:10 -08:00
Santiago Pastorino
5843069e7e Rack body respond to each and not to join
This fixes undef `to_str' for Rack::Chunked::Body when using
caches_action + streaming on an action

Closes #5027
2012-02-14 21:53:15 -02:00
Carlos Antonio da Silva
71566c3573 Remove rescue_action from compatibility module and tests 2012-01-17 10:04:37 -02:00
Carlos Antonio da Silva
bc50cb31d6 Remove old compatibility methods not being used 2012-01-17 10:04:37 -02:00
José Valim
39081f1660 Provide a class optin for page_cache_compression. 2011-12-24 09:54:29 +01:00
Andrey A.I. Sitnik
7b1ac55f50 Gzip files on page caching
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-12-24 09:42:34 +01:00
Thomas von Deyen
0da31a1839 Allowing string as url argument for expire_action 2011-12-06 13:05:15 +01:00
Christopher Meiklejohn
6cbe4223a7 Ensure that the format isn't applied twice to the cache key, else it becomes impossible to target with expire_action. 2011-10-31 15:10:07 -04:00
Santiago Pastorino
8f11d53506 Merge pull request #2219 from kommen/fix_fragment_caching_squashed
Fix fragment caching (squashed commits)
2011-10-13 13:36:20 -07:00
José Valim
43d27e9105 Deprecate passing the template handler in the template name.
For example, calling hello.erb is now deprecated. Since Rails 3.0
passing the handler had no effect whatsover. This commit simply
deprecates such cases so we can clean up the code in later releases.
2011-09-22 15:37:38 +02:00
Neeraj Singh
fdbe8eb08c replaced and with && as per coding guidelines 2011-06-10 02:27:57 -04:00
Neeraj Singh
49d032929b The test name is misleading. It says
test_should_cache_with_trailing_slash_on_url

A trailing slash is removed when a page is cached.

What the test meant to say was : a url with trailing slash
should be cached and the cached page should not have any
trailing slash.

This patch clarifies the name a bit.
2011-06-10 02:24:37 -04:00
wycats
7b9f3eb10b Always initialize @title in caching test to avoid uninitialized instance variable warning 2011-05-22 23:14:52 -07:00
Xavier Noria
5850f16935 removes the RJS template handler 2011-04-13 13:23:18 +02:00
Cheah Chu Yeow
2ee5555744 Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body.
Note that only GET and HTTP 200 responses can be cached.

[#6480 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-02 13:11:07 -02:00
Andre Arko
10cab35d3b Allow page_cache_directory to be set as a Pathname
For example, page_cache_directory = Rails.root.join("public/cache")

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-06 17:55:38 -02:00
Aaron Patterson
36d6678690 removing usesless variable assignments 2011-01-18 15:52:56 -08:00
Neeraj Singh
0027b65421 Ensure that while caching a page rails takes into
account the resolved mime type for the request

[#6110 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 16:14:57 +01:00
Emilio Tagua
3abd0593a6 Initialize ivars in tests. 2010-09-28 17:32:18 -03:00
Emilio Tagua
2d274a5208 Use parentheses when using assert_match followed by a regexp to avoid warnings. 2010-09-27 11:19:19 -03:00
Aaron Patterson
2d65ff5af7 removing some warnings 2010-09-18 14:14:46 -07:00
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
David Heinemeier Hansson
585f8f27b1 Fixed double output from cache in no caching mode 2010-06-08 14:47:02 -04:00
Neeraj Singh
d793d30776 ActionCachingTestController rescues from all exceptions. Making sure that all the tests check for valid response. [#4468 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-29 12:48:34 +02:00
Santiago Pastorino and Carl Lerche
0ea434e2f4 Make perform_caching work again, with the tests passing and backward compatible 2010-04-15 18:25:08 -03:00
Joshua Peek
cdf8c35ffd Consistent routing language 2010-03-30 14:05:42 -05:00
wycats
e1c030edd8 Fixed a bunch of tests that failed in 1.9 because they assumed that a Rack response was a String. 2010-03-19 18:46:29 -07:00
Carlhuda
71c9337f45 All tests pass without memoizing view_context 2010-03-18 15:52:43 -07:00
Carlhuda
c61ed70b00 Some more tweaks on <% %>.
* The cache helper is now semantically "mark this region for caching"
  * As a result, <% x = cache do %> no longer works
2010-03-16 11:43:04 -07:00
Jeremy Kemper
b65b989725 Break a window :/ 2010-03-15 23:49:35 -07:00
Carlhuda
9de83050d3 Add deprecation notices for <% %>.
* The approach is to compile <% %> into a method call that checks whether
    the value returned from a block is a String. If it is, it concats to the buffer and
    prints a deprecation warning.
  * <%= %> uses exactly the same logic to compile the template, which first checks
    to see whether it's compiling a block.
  * This should have no impact on other uses of block in templates. For instance, in
    <% [1,2,3].each do |i| %><%= i %><% end %>, the call to each returns an Array,
    not a String, so the result is not concatenated
  * In two cases (#capture and #cache), a String can be returned that should *never*
    be concatenated. We have temporarily created a String subclass called NonConcattingString
    which behaves (and is serialized) identically to String, but is not concatenated
    by the code that handles deprecated <% %> block helpers. Once we remove support
    for <% %> block helpers, we can remove NonConcattingString.
2010-03-15 14:50:43 -07:00
Jeremy Kemper
16572fd46e read_ and write_fragment cache preserve html safety yet cache strings only 2010-03-14 19:09:32 -07:00
Joshua Peek
dcd110c724 skip_relative_url_root url_for option is dead 2010-03-09 21:25:09 -06:00
Joshua Peek
4d2470f7da RouteSet#rewrite => url_for 2010-03-09 21:00:24 -06:00
Joshua Peek
7db80f87e9 Move AC::UrlRewriter onto route set 2010-03-09 20:50:35 -06:00
wycats
de79525d04 Get rid of the instance-level URL rewriter 2010-03-09 10:20:56 -08:00
Carlhuda
ff29606c06 Refactor cache_store to use ActionController config 2010-03-04 16:50:57 -08:00
Carl Lerche
18bcce596e ActionController::Base.use_accept_header is not actually used anymore, so let's deprecate it. 2010-03-03 21:24:00 -08:00
Carl Lerche
eb49bd6949 Fix tests for the request refactor 2010-03-03 21:24:00 -08:00
Carlhuda
050831803a If IntegrationSession is initialized with an objects that responds to #routes, automatically extend the URL helpers from the RouteSet onto it 2010-02-26 17:18:45 -08:00
Carlhuda
98f77e0827 Rename named_url_helpers to url_helpers and url_helpers to url_for 2010-02-26 15:04:50 -08:00
Carlhuda
f863045c45 Rename metaclass to singleton_class 2010-02-25 17:56:58 -08:00
Carlhuda
a278f23310 Fix all of AP's tests with the non global router 2010-02-25 17:53:01 -08:00
Yehuda Katz
4cbb9db0a5 For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do
    safe_concat("</form>"), which will skip both the flag set, and the flag
    check.
  * For the first pass, I converted virtually all #html_safe!s to #html_safe,
    and the tests pass. A further optimization would be to try to use
    #safe_concat as much as possible, reducing the performance impact if
    we know up front that a String is safe.
2010-01-31 19:39:13 -08:00
José Valim
da5978c223 Add subscriber for ActionPack and move all logging inside it. 2010-01-13 01:19:23 +01:00
José Valim
f2d276fefd Ensure no notification is on the queue before running notifications related tests. 2010-01-03 23:39:09 +01:00
José Valim
6fbe9ef2ff Use namespaces in notifications. 2010-01-03 20:39:42 +01:00
José Valim
75ba102a80 Remove ActionView inline logging to ActiveSupport::Notifications and create ActionController::Base#log_event, so everything can be logged within one listener. Also expose log_process_action as a hook for different modules to include their own information during the action processing. This allow ActiveRecord to hook and any other ORM. Finally, this commit changes 'Processing' and 'Rendering' in logs to 'Processed' and 'Rendered' because at the point it's logged, everying already happened. 2009-12-26 20:28:53 +01:00
Joshua Peek
9fbde11b8b More test porting 2009-12-08 17:41:00 -06:00
Jeremy Kemper
0c4990b5f4 Fix caching test to ensure notifications are all delivered 2009-12-01 12:19:42 -08:00