1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/test/controller
claudiob 050fda0206 Accept a collection in fresh_when and stale?
The methods `fresh_when` and `stale?` from ActionController::ConditionalGet
accept a single record as a short form for a hash. For instance

```ruby
  def show
    @article = Article.find(params[:id])
    fresh_when(@article)
  end
```

is just a short form for:

```ruby
  def show
    @article = Article.find(params[:id])
    fresh_when(etag: @article, last_modified: @article.created_at)
  end
```

This commit extends `fresh_when` and `stale?` to also accept a collection
of records, so that a short form similar to the one above can be used in
an `index` action. After this commit, the following code:

```ruby
def index
  @article = Article.all
  fresh_when(etag: @articles, last_modified: @articles.maximum(:created_at))
end
```

can be simply written as:

```ruby
def index
  @article = Article.all
  fresh_when(@articles)
end
```
2015-02-10 17:08:44 -08:00
..
controller_fixtures
mime Migrating xhr methods to keyword arguments syntax 2015-02-01 16:07:42 +03:00
new_base Consistent usage of spaces in hashes across our codebase 2015-01-29 12:19:41 -02:00
parameters Add AC::Parameters#to_unsafe_h 2014-12-12 18:52:10 +07:00
request
action_pack_assertions_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
base_test.rb Consistent usage of spaces in hashes across our codebase 2015-01-29 12:19:41 -02:00
caching_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
content_type_test.rb Add with_default_charset helper. 2014-05-28 21:17:16 +08:00
default_url_options_with_before_action_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
filters_test.rb Add test/doc for :if/:except in skip_before_action 2015-01-08 09:30:31 -08:00
flash_hash_test.rb Migrate old flash behaviour 2015-01-30 09:47:03 +11:00
flash_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
force_ssl_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
helper_test.rb Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846 2015-01-31 23:12:41 -05:00
http_basic_authentication_test.rb Add test for HTTP basic authentication when no credential is given. 2015-01-24 07:17:11 +08:00
http_digest_authentication_test.rb
http_token_authentication_test.rb Allow authentication header to not have to specify 'token=' key. 2014-10-10 09:38:03 +08:00
integration_test.rb Merge pull request #18771 from kirs/deprecate-xhr 2015-02-05 18:27:47 -02:00
live_stream_test.rb When your templates change, browser caches bust automatically. 2014-08-17 06:52:17 -07:00
localized_templates_test.rb Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846 2015-01-31 23:12:41 -05:00
log_subscriber_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
output_escaping_test.rb
params_wrapper_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
permitted_params_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
redirect_test.rb Don't accept parameters as argument for redirect to [via @homakov] 2014-07-16 12:21:51 -03:00
render_js_test.rb Migrating xhr methods to keyword arguments syntax 2015-02-01 16:07:42 +03:00
render_json_test.rb Migrating xhr methods to keyword arguments syntax 2015-02-01 16:07:42 +03:00
render_other_test.rb Add and remove renderer inside the test to prevent leak. 2014-05-28 22:24:22 +08:00
render_test.rb Accept a collection in fresh_when and stale? 2015-02-10 17:08:44 -08:00
render_xml_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
renderer_test.rb ✂️ warning from controller renderer test 2015-01-31 17:48:55 -08:00
request_forgery_protection_test.rb Migrating xhr methods to keyword arguments syntax 2015-02-01 16:07:42 +03:00
required_params_test.rb Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration 2015-01-29 14:44:46 +02:00
rescue_test.rb
resources_test.rb Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846 2015-01-31 23:12:41 -05:00
routing_test.rb Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 onwards. 2015-02-03 20:51:40 +05:30
runner_test.rb
send_file_test.rb Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 onwards. 2015-02-03 20:51:40 +05:30
show_exceptions_test.rb Consistent usage of spaces in hashes across our codebase 2015-01-29 12:19:41 -02:00
streaming_test.rb
test_case_test.rb Merge pull request #18771 from kirs/deprecate-xhr 2015-02-05 18:27:47 -02:00
url_for_integration_test.rb Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 onwards. 2015-02-03 20:51:40 +05:30
url_for_test.rb Merge branch 'nil_script_name' 2014-11-25 10:31:26 -02:00
url_rewriter_test.rb
webservice_test.rb Consistent usage of spaces in hashes across our codebase 2015-01-29 12:19:41 -02:00