| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Since all controller instances are required to have a request and
response object, RackDelegation is no longer needed (we always have to
delegate to the response)
|
|
|
|
|
|
|
|
|
|
| |
spelling fix [ci skip]
example to be consistent [ci skip]
grammatical fix
typo fixes [ci skip]
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Add http_cache_forever to ActionController, so we can cache results
forever.
Things like static pages are a good candidate for this type of caching.
This cache only controls caching headers, so it is up to the browser to
cache those requests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
```
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR #18772 changed the parameters of `stale?` to use `kwargs`.
[As for this comment](https://github.com/rails/rails/pull/18872/files#r24456288)
the default value for the `etag` parameter should be `record`, not `nil`.
This commit fixes the code and introduces a test that:
- passed before #18872
- fails on the current master (after #18772)
- passes again after setting the default value of `etag` to `record`.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
It is clearer and closer to reality to use `@article.updated_at` as
the `:last_modified` parameter of `fresh_when` and `stale?`.
Using `@article.created_at` would result in the cache never expiring,
since the creation timestamp never changes.
[ci skip]
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New default: the template digest is automatically included in your ETags.
When you call `fresh_when @post`, the digest for `posts/show.html.erb`
is mixed in so future changes to the HTML will blow HTTP caches for you.
This makes it easy to HTTP-cache many more of your actions.
If you render a different template, you can now pass the `:template`
option to include its digest instead:
fresh_when @post, template: 'widgets/show'
Pass `template: false` to skip the lookup. To turn this off entirely, set:
config.action_controller.etag_with_template_digest = false
|
| |
|
|
|
|
|
|
|
| |
* core_ext/object/blank
* concern
* core_ext/class/attribute
* deprecation
|
|
|
|
|
|
|
|
|
|
| |
Sometimes, on Mac OS X, programmers accidentally press Option+Space
rather than just Space and don’t see the difference. The problem is
that Option+Space writes a non-breaking space (0XA0) rather than a
normal space (0x20).
This commit removes all the non-breaking spaces inadvertently
introduced in the comments of the code.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
computation *Jeremy Kemper/DHH*
|
| |
|
|
|
|
| |
max-stale is a cache request header.
|
|\
| |
| | |
Ensure Date header on expires_in
|
| |
| |
| |
| | |
#expires_in
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
fresh_when/stale? conditional get methods from Action Pack"
Needless indirection with no added value.
This reverts commit 535853e83b9092078035a5abb2aa242fba815c05.
|
| |
| |
| |
| | |
fresh_when/stale? conditional get methods from Action Pack
|
|/ |
|
| |
|
|
|
| |
Time#utc does not need to be called when passing the object to :last_modified since it is called internally to Rails.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
their module locations
|