aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/conditional_get.rb
Commit message (Collapse)AuthorAgeFilesLines
* Spelling/typo/grammatical fixes [ci skip]karanarora2015-05-231-2/+2
| | | | | | | | | | spelling fix [ci skip] example to be consistent [ci skip] grammatical fix typo fixes [ci skip]
* Doc fix [ci skip]Sushruth Sivaramakrishnan2015-03-051-1/+1
|
* Tiny documentation edits [ci skip]Robin Dupret2015-02-151-3/+3
|
* Implement http_cache_forever to ActionControllerArthur Neves2015-02-151-0/+18
| | | | | | | | | 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.
* Accept a collection in fresh_when and stale?claudiob2015-02-101-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Fix wrong kwarg "record" from #18872claudiob2015-02-101-1/+1
| | | | | | | | | | | | 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`.
* Convert stale? and fresh_when to use keyword arguments.Kasper Timm Hansen2015-02-101-12/+10
|
* Better examples for fresh_when and stale?claudiob2015-01-061-2/+2
| | | | | | | | | | 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]
* Consistently markup etag options.Steven Harman2014-09-161-3/+3
|
* Consistently capitalize ETag.Steven Harman2014-09-161-3/+3
|
* When your templates change, browser caches bust automatically.Jeremy Kemper2014-08-171-6/+31
| | | | | | | | | | | | | | | | 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
* Missing require hash/keysAkira Matsuda2013-02-011-0/+2
|
* These are already required through AS/railsAkira Matsuda2013-01-061-2/+0
| | | | | | | * core_ext/object/blank * concern * core_ext/class/attribute * deprecation
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-1/+1
| | | | | | | | | | 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.
* Multiple changes to 1,9 hash syntaxAvnerCohen2012-10-271-1/+1
|
* update AC::ConditionalGet documentation [ci skip]Francesco Rodriguez2012-09-221-27/+31
|
* Use merge! to merge additional options onto default optionsCarlos Antonio da Silva2012-09-071-4/+3
|
* Fixes warning: & interpreted as argument prefixkennyj2012-08-301-1/+1
|
* Use class_attribute so we dont bleedDavid Heinemeier Hansson2012-08-291-1/+6
|
* Added controller-level etag additions that will be part of the action etag ↵David Heinemeier Hansson2012-08-291-4/+34
| | | | computation *Jeremy Kemper/DHH*
* Removing ==Examples and last blank lines of docs from actionpackFrancesco Rodriguez2012-05-151-1/+0
|
* Removed max-stale from the setting the cache-headers in the response as ↵Anuj Dutta2012-03-021-1/+1
| | | | max-stale is a cache request header.
* Merge pull request #3479 from arvida/ensure-date-header-on-expires-inJosé Valim2012-02-181-0/+3
|\ | | | | Ensure Date header on expires_in
| * Ensuring a HTTP Date header when setting Cache-Control's max-age with ↵arvida2011-10-311-0/+3
| | | | | | | | #expires_in
* | let expires_in accept a must_revalidate flagXavier Noria2012-02-171-2/+6
| |
* | Revert "Added ActiveRecord::Base#last_modified to work with the new ↵David Heinemeier Hansson2011-12-011-2/+2
| | | | | | | | | | | | | | | | fresh_when/stale? conditional get methods from Action Pack" Needless indirection with no added value. This reverts commit 535853e83b9092078035a5abb2aa242fba815c05.
* | Added ActiveRecord::Base#last_modified to work with the new ↵David Heinemeier Hansson2011-12-011-2/+2
| | | | | | | | fresh_when/stale? conditional get methods from Action Pack
* | Allow fresh_when/stale? to take a record instead of an options hash [DHH]David Heinemeier Hansson2011-12-011-4/+49
|/
* Fix small typo in documentationKrekoten' Marjan2010-10-121-1/+1
|
* Small tweak the ConditionalGet documentationCarl Lerche2010-09-171-2/+2
| | | Time#utc does not need to be called when passing the object to :last_modified since it is called internally to Rails.
* cleanup of ActionController::Metal inline documentationJoost Baaij2010-08-261-6/+6
|
* Rename RackConvenience => RackDelegationJoshua Peek2009-12-201-1/+1
|
* Fixes expires_now and cleans things up a bitYehuda Katz2009-10-261-1/+1
|
* Extract #head into its own module and simplify itYehuda Katz2009-10-261-36/+3
|
* Add nagivational behavior to respond_with.José Valim2009-08-071-3/+4
|
* Rename /base to /metal and make base.rb and metal.rb top-level to reflect ↵Yehuda Katz2009-08-061-0/+118
their module locations