1. 18 7月, 2015 1 次提交
    • P
      Stop using deprecated `render :text` in test · 8cb8ce98
      Prem Sichanugrist 提交于
      This will silence deprecation warnings.
      
      Most of the test can be changed from `render :text` to render `:plain`
      or `render :body` right away. However, there are some tests that needed
      to be fixed by hand as they actually assert the default Content-Type
      returned from `render :body`.
      8cb8ce98
  2. 16 6月, 2015 1 次提交
  3. 12 6月, 2015 1 次提交
  4. 28 5月, 2015 1 次提交
  5. 13 3月, 2015 1 次提交
    • J
      Return true from head method · d5efb1f9
      Joel Hayhurst 提交于
      It was returning false in normal circumstances.
      This broke the `head :ok and return if` construct.
      Add appropriate test.
      d5efb1f9
  6. 16 2月, 2015 1 次提交
    • A
      Implement http_cache_forever to ActionController · 2ed39424
      Arthur Neves 提交于
      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.
      2ed39424
  7. 11 2月, 2015 2 次提交
    • C
      Accept a collection in fresh_when and stale? · 050fda02
      claudiob 提交于
      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
      ```
      050fda02
    • C
      Fix wrong kwarg "record" from #18872 · c7331e05
      claudiob 提交于
      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`.
      c7331e05
  8. 29 1月, 2015 1 次提交
  9. 12 1月, 2015 1 次提交
  10. 31 12月, 2014 1 次提交
    • R
      Correctly use the response's status code calling head · 7ef7f1cc
      Robin Dupret 提交于
      Commit 20fece14 introduced the `_status_code` method to fix calls to
      `head :ok`. This method has been added on both ActionController::Metal
      and ActionDispatch::Response.
      
      As for the latter, this method is just equivalent to the `response_code`
      one so commit aefec3c6 removed it from the `Reponse` object so call to
      the `_status_code` method on an ActionController::Base instance would be
      handled by the `Metal` class (which `Base` inherits from) but the status
      code is not updated according to the response at this level.
      
      The fix is to actually rely on `response_code` for ActionController::Base
      instances but this method doesn't exist for bare Metal controllers so we
      need to define it.
      7ef7f1cc
  11. 17 8月, 2014 1 次提交
    • J
      When your templates change, browser caches bust automatically. · 6c96602b
      Jeremy Kemper 提交于
      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
      6c96602b
  12. 06 6月, 2014 2 次提交
  13. 05 12月, 2013 1 次提交
  14. 25 8月, 2013 2 次提交
  15. 18 8月, 2013 1 次提交
  16. 26 7月, 2013 1 次提交
  17. 19 6月, 2013 1 次提交
  18. 07 5月, 2013 1 次提交
  19. 06 1月, 2013 2 次提交
  20. 31 12月, 2012 1 次提交
  21. 20 12月, 2012 1 次提交
  22. 08 12月, 2012 1 次提交
  23. 20 11月, 2012 1 次提交
  24. 06 10月, 2012 1 次提交
  25. 30 8月, 2012 1 次提交
  26. 01 8月, 2012 1 次提交
  27. 21 6月, 2012 1 次提交
    • A
      Removed warnings. · 6f6111e0
      Arun Agrawal 提交于
      1. Change in test name as already defined.
      2. ambiguous first argument; put parentheses or 
      even spaces
      6f6111e0
  28. 19 6月, 2012 2 次提交
    • D
      Added test for case when view doesn't have logger method when using... · e8f9e667
      Dmitry Vorotilin 提交于
      Added test for case when view doesn't have logger method when using ActionController::Metal controller.
      e8f9e667
    • J
      Ensure that cache-control headers are merged · 0b4e8c8d
      James Tucker 提交于
      There are several aspects to this commit, that don't well fit into broken down
      commits, so they are detailed here:
      
       * When a user uses response.headers['Cache-Control'] = some_value, then the
         documented convention in ConditionalGet is not adhered to, in this case,
         response.cache_control is ignored due to `return if
         self[CACHE_CONTROL].present?`
       * When a middleware sets cache-control headers that would clobber, they're
         converted to symbols directly, without underscores. This would lead to bugs.
       * Items that would live in :extras if set through expires_in, are placed
         directly in the @cache_control hash, and not respected in many cases
         (somewhat adhering to the aforementioned documentation).
       * Although quite useless, any directive named 'extras' would be ignored.
      
      The general convention applied is that expires_* take precedence, but no longer
      overwrite everything and expires_* are ALWAYS applied, even if the header is
      set.
      
      I am still unhappy about the contents of this commit, and the code in general.
      Ideally it should be refactored to no longer use :extras. I'd likely recommend
      expanding @cache_control into a class, and giving it the power to handle the
      merge in a more efficient fashion. Such a commit would be a larger change that
      could have additional semantic changes for other libraries unless they utilize
      expires_in in very standard ways.
      0b4e8c8d
  29. 08 5月, 2012 1 次提交
  30. 25 4月, 2012 1 次提交
    • J
      Remove default match without specified method · 56cdc81c
      Jose and Yehuda 提交于
      In the current router DSL, using the +match+ DSL
      method will match all verbs for the path to the
      specified endpoint.
      
      In the vast majority of cases, people are
      currently using +match+ when they actually mean
      +get+. This introduces security implications.
      
      This commit disallows calling +match+ without
      an HTTP verb constraint by default. To explicitly
      match all verbs, this commit also adds a
      :via => :all option to +match+.
      
      Closes #5964
      56cdc81c
  31. 29 3月, 2012 1 次提交
  32. 27 3月, 2012 1 次提交
    • P
      If partial is rendered in controller, grab format from template · 67b2404c
      Piotr Sarnacki 提交于
      Previously `rendered_format` was set only based on mime types
      passed in Accept header, which was wrong if first type from
      Accept was different than rendered partial. The fix is to simply
      move setting rendered_format to the place where template
      is available and grab format from the template. If it fails
      we can fallback to formats passed by Accept header.
      67b2404c
  33. 17 3月, 2012 1 次提交
  34. 10 3月, 2012 1 次提交
  35. 02 3月, 2012 1 次提交