aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/conditional_get.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #26016 from nateberkopec/patch-1Vipul A M2016-09-071-2/+3
|\ | | | | Clarify expires_now documentation
| * Clarify expires_now documentationNate Berkopec2016-09-061-2/+3
| | | | | | | | [ci skip]
* | Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | modernizes hash syntax in actionpackXavier Noria2016-08-061-4/+4
| |
* | applies new string literal convention in actionpack/libXavier Noria2016-08-061-1/+1
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Tiny document fixes [ci skip]Robin Dupret2016-05-301-1/+1
| | | | | | Add a missing capital letter and avoid using absolute links to the API because they may refer to out-dated documentation on the Edge site.
* Grammar fixes based on pass over ETag doc changesVipul A M2016-04-031-2/+2
| | | | [ci skip]
* Grammer fix in comment: capitalize first word in sentence [ci skip].utilum2016-04-021-1/+1
|
* Strong ETag validatorsJeremy Daer2016-03-311-13/+46
| | | | | | | | | | | | | | | | | | * Introduce `Response#strong_etag=` and `#weak_etag=` and analogous options for `fresh_when` and `stale?`. `Response#etag=` sets a weak ETag. Strong ETags are desirable when you're serving byte-for-byte identical responses that support Range requests, like PDFs or videos (typically done by reproxying the response from a backend storage service). Also desirable when fronted by some CDNs that support strong ETags only, like Akamai. * No longer strips quotes (`"`) from ETag values before comparing them. Quotes are significant, part of the ETag. A quoted ETag and an unquoted one are not the same entity. * Support `If-None-Match: *`. Rarely useful for GET requests; meant to provide some optimistic concurrency control for PUT requests.
* Remove http_cache_forever's version parameterJean Boussier2016-03-051-4/+2
|
* Change 'a HTTP' to 'an HTTP' [ci skip]Santosh Wadghule2016-03-031-4/+4
|
* Avoid `Time.parse` for static dateRafaël Blais Masson2015-12-301-1/+1
| | | | | | | | | | | | | | Benchmark.ips do |x| x.report('Time.parse') { Time.parse('2011-01-01') } x.report('Time.new') { Time.new(2011, 1, 1) } end Calculating ------------------------------------- Time.parse 6.640k i/100ms Time.new 15.082k i/100ms ------------------------------------------------- Time.parse 71.915k (± 3.1%) i/s - 365.200k Time.new 167.645k (± 3.3%) i/s - 844.592k
* [ci skip] Fix <tt> in docclaudiob2015-11-151-1/+1
|
* remove RackDelegation moduleAaron Patterson2015-08-261-1/+0
| | | | | | 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/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