1. 12 3月, 2017 1 次提交
  2. 16 8月, 2016 1 次提交
  3. 07 8月, 2016 1 次提交
  4. 25 2月, 2016 1 次提交
  5. 21 1月, 2016 2 次提交
  6. 25 10月, 2015 1 次提交
  7. 07 10月, 2015 1 次提交
    • J
      Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compat · 565094a8
      Jeremy Daer 提交于
      Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
      that support multiple Rails versions would've had to feature-detect
      whether to use `Mime::Type[:FOO]` or `Mime::FOO`.
      
      `Mime[:foo]` has been around for ages to look up registered MIME types
      by symbol / extension, though, so libraries and plugins can safely
      switch to that without breaking backward- or forward-compatibility.
      
      Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
      by type or extension, so it's not available as `Mime[:all]`. We use it
      internally as a wildcard for `respond_to` negotiation. If you use this
      internal constant, continue to reference it with `Mime::ALL`.
      
      Ref. efc6dd55
      565094a8
  8. 22 9月, 2015 2 次提交
  9. 09 9月, 2015 1 次提交
  10. 27 8月, 2015 1 次提交
  11. 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
  12. 25 3月, 2015 1 次提交
  13. 05 1月, 2015 2 次提交
  14. 06 11月, 2014 1 次提交
  15. 19 10月, 2014 3 次提交
  16. 18 10月, 2014 1 次提交
    • C
      Replace (slower) block.call with (faster) yield · 6aa115e4
      claudiob 提交于
      Performance optimization: `yield` with an implicit `block` is faster than `block.call`.
      See http://youtu.be/fGFM_UrSp70?t=10m35s and the following benchmark:
      
      ```ruby
      require 'benchmark/ips'
      
      def fast
       yield
      end
      
      def slow(&block)
       block.call
      end
      
      Benchmark.ips do |x|
       x.report('fast') { fast{} }
       x.report('slow') { slow{} }
      end
      
      # => fast    154095 i/100ms
      # => slow     71454 i/100ms
      # =>
      # => fast  7511067.8 (±5.0%) i/s -   37445085 in   4.999660s
      # => slow  1227576.9 (±6.8%) i/s -    6145044 in   5.028356s
      ```
      6aa115e4
  17. 18 8月, 2014 4 次提交
  18. 09 8月, 2014 1 次提交
  19. 17 6月, 2014 1 次提交
  20. 14 2月, 2014 1 次提交
  21. 13 2月, 2014 1 次提交
    • L
      Variant negotiation · f9b6b865
      Lukasz Strzalkowski 提交于
      Allow setting `request.variant` as an array - an order in which they will be
      rendered.
      
      For example:
      
        request.variant = [:tablet, :phone]
      
        respond_to do |format|
          format.html.none
          format.html.phone # this gets rendered
        end
      f9b6b865
  22. 27 12月, 2013 1 次提交
    • Ł
      Add any/all support for variants · a288cc1e
      Łukasz Strzałkowski 提交于
      Like `format.any`, you can do the same with variants.
      
      It works for both inline:
      
          respond_to do |format|
            format.html.any   { render text: "any"   }
            format.html.phone { render text: "phone" }
          end
      
      and block syntax:
      
          respond_to do |format|
            format.html do |variant|
              variant.any(:tablet, :phablet){ render text: "any" }
              variant.phone { render text: "phone" }
            end
          end
      a288cc1e
  23. 18 12月, 2013 1 次提交
    • G
      Some assorted fixes for the 4.1 release notes: · 2003d040
      Godfrey Chan 提交于
      * Added release notes for secrets.yml and mentioned it in the highlights
      * Added release notes for Mailer previews and mentioned it in the highlights
      * Added release notes for Module#concerning
      * Removed mention for AV extraction from the highlights
      * Rearranged the major features to put highlighted features first
      * Various improvements and typo fixes
      
      [ci skip]
      2003d040
  24. 12 12月, 2013 1 次提交
  25. 10 12月, 2013 2 次提交
    • Ł
      Inline variants syntax · edacdbfa
      Łukasz Strzałkowski 提交于
      In most cases, when setting variant specific code, you're not sharing any code
      within format.
      
      Inline syntax can vastly simplify defining variants in those situations:
      
        respond_to do |format|
          format.js { render "trash" }
          format.html do |variant|
            variant.phone { redirect_to progress_path }
            variant.none  { render "trash" }
          end
        end
      
      Becomes:
      
        respond_to do |format|
          format.js         { render "trash" }
          format.html.phone { redirect_to progress_path }
          format.html.none  { render "trash" }
        end
      edacdbfa
    • Ł
      Simplify @responses hash initialization · fbb6be50
      Łukasz Strzałkowski 提交于
      @responses hash needs to be initialized with mime types that we get from
      Collector#collect_mimes_from_class_level. Mime::Type class as key and nil as
      value. This need to happen before content negotiation. Before that, it was
      looping though mime types and executing mime-type-generated method inside
      collector (see
      AbstractController::Collector#generate_method_for_mime). That approach resulted
      in 2 unnecessary method calls for each mime type
      collected by Collector#collect_mimes_from_class_level.
      
      Now hash is initialized in place, without usage of Collector#custom method.
      fbb6be50
  26. 09 12月, 2013 3 次提交
    • D
      Revert "Merge pull request #13235 from strzalek/variants-inline" -- needs a little more work! · 4aae538d
      David Heinemeier Hansson 提交于
      This reverts commit 18616114, reversing
      changes made to cad9eb17.
      4aae538d
    • Ł
      Inline variants syntax · 2647d2f6
      Łukasz Strzałkowski 提交于
      In most cases, when setting variant specific code, you're not sharing any code
      within format.
      
      Inline syntax can vastly simplify defining variants in those sitiations:
      
        respond_to do |format|
          format.js { render "trash" }
          format.html do |variant|
            variant.phone { redirect_to progress_path }
            variant.none  { render "trash" }
          end
        end
      `
      Becomes:
      
        respond_to do |format|
          format.js         { render "trash" }
          format.html.phone { redirect_to progress_path }
          format.html.none  { render "trash" }
        end
      2647d2f6
    • Ł
      Simplify @responses hash initialization · 9b8c0ff3
      Łukasz Strzałkowski 提交于
      @responses hash needs to be initialized with mime types that we get from
      Collector#collect_mimes_from_class_level. Mime::Type class as key and nil as
      value. This need to happen before content negotiation. Before that, it was
      looping though mime types and executing mime-type-generated method inside
      collector (see
      AbstractController::Collector#generate_method_for_mime). That approach resulted
      in 2 unnecessary method calls for each mime type
      collected by Collector#collect_mimes_from_class_level.
      
      Now hash is initialized in place, without usage of Collector#custom method.
      9b8c0ff3
  27. 08 12月, 2013 2 次提交
  28. 04 12月, 2013 1 次提交