Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source
Show
Ignore:
Timestamp:
03/07/08 11:17:05 (7 months ago)
Author:
pratik
Message:

Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/mime_responds.rb

    r8027 r8987  
    126126        @order << mime_type 
    127127 
    128         @responses[mime_type] = Proc.new do 
     128        @responses[mime_type] ||= Proc.new do 
    129129          @response.template.template_format = mime_type.to_sym 
    130130          @response.content_type = mime_type.to_s 
     
    134134 
    135135      def any(*args, &block) 
    136         args.each { |type| send(type, &block) } 
     136        if args.any? 
     137          args.each { |type| send(type, &block) } 
     138        else 
     139          custom(@mime_type_priority.first, &block) 
     140        end 
    137141      end 
    138142