public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
Fix perform_content_negotiation to correctly handle :format in params. Fix 
render_* to correctly return the correct content_type.
wycats (author)
Tue Mar 04 15:53:03 -0800 2008
commit  315e3c81828d33694d3ef279060dbac09a56aadc
tree    7926e9b8928d9d66aba5a5c685ff3663d418e677
parent  4faa93bc6561fa9366dcb97e89775a08d29c086d
...
42
43
44
45
 
46
47
48
...
42
43
44
 
45
46
47
48
0
@@ -42,7 +42,7 @@
0
 
0
       Merb::RenderMixin.class_eval <<-EOS, __FILE__, __LINE__
0
         def render_#{key}(thing = nil, opts = {})
0
- content_type = :#{key}
0
+ self.content_type = :#{key}
0
           render thing, opts
0
         end
0
       EOS
...
287
288
289
290
 
 
 
 
291
292
293
294
295
296
...
287
288
289
 
290
291
292
293
294
 
 
295
296
297
0
@@ -287,10 +287,11 @@
0
     def _perform_content_negotiation # :nodoc:
0
       raise Merb::ControllerExceptions::NotAcceptable if _provided_formats.empty?
0
       if (fmt = params[:format]) && !fmt.empty?
0
- return fmt.to_sym
0
+ accepts = [fmt.to_sym]
0
+ else
0
+ accepts = Responder.parse(request.accept).map {|t| t.to_sym}
0
+ accepts.compact!
0
       end
0
- accepts = Responder.parse(request.accept).map {|t| t.to_sym}
0
- accepts.compact!
0
       return _provided_formats.first if accepts.first == :all
0
       (accepts & _provided_formats).first || (raise Merb::ControllerExceptions::NotAcceptable)
0
     end

Comments

    No one has commented yet.