Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7682: better_document_exempt.diff

File better_document_exempt.diff, 1.0 kB (added by wycats, 1 year ago)
  • actionpack/lib/action_controller/mime_responds.rb

    old new  
    9797      # environment.rb as follows. 
    9898      # 
    9999      #   Mime::Type.register "image/jpg", :jpg 
     100      # 
     101      # Note that if you want to exempt a particular format (like rxml) from a template, you'll need to use 
     102      # ActionController::Base.exempt_from_layout, as follows. 
     103      # 
     104      #  class FooController < ApplicationController 
     105      #    exempt_from_layout :rxml 
     106      # 
     107      #    def foo 
     108      #      respond_to do |format| 
     109      #        format.html 
     110      #        format.xml 
     111      #      end 
     112      #    end 
     113      #  end 
    100114      def respond_to(*types, &block) 
    101115        raise ArgumentError, "respond_to takes either types or a block, never both" unless types.any? ^ block 
    102116        block ||= lambda { |responder| types.each { |type| responder.send(type) } }