1. 31 7月, 2018 1 次提交
    • P
      Raises exception when respond_to called multiple times in incompatible way · 84e8b350
      Patrick Toomey 提交于
      Nesting respond_to calls can lead to unexpected behavior, so it should be
      avoided. Currently, the first respond_to format match sets the content-type
      for the resulting response. But, if a nested respond_to occurs, it is possible
      to match on a different format. For example:
      
          respond_to do |outer_type|
            outer_type.js do
              respond_to do |inner_type|
                inner_type.html { render body: "HTML" }
              end
            end
          end
      
      Browsers will often include */* in their Accept headers. In the above example,
      such a request would result in the outer_type.js match setting the content-
      type of the response to text/javascript, while the inner_type.html match will
      cause the actual response to return "HTML".
      
      This change tries to minimize potential breakage by only raising an exception
      if the nested respond_to calls are in conflict with each other. So, something
      like the following example would not raise an exception:
      
          respond_to do |outer_type|
            outer_type.js do
              respond_to do |inner_type|
                inner_type.js { render body: "JS" }
              end
            end
          end
      
      While the above is nested, it doesn't affect the content-type of the response.
      84e8b350
  2. 27 7月, 2018 1 次提交
  3. 26 7月, 2018 9 次提交
  4. 25 7月, 2018 2 次提交
  5. 24 7月, 2018 4 次提交
  6. 23 7月, 2018 2 次提交
  7. 22 7月, 2018 17 次提交
  8. 21 7月, 2018 4 次提交