Browse files

Short documentation to mention use of Mime::Type.register. #5710 [cho…

…onkeat@gmail.com]. Merge doc patches with stable.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4695 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 14ed31d commit 4fd92b6fc376fb29198544316b47dacfe09581a5 Marcel Molina committed Aug 7, 2006
Showing with 9 additions and 1 deletion.
  1. +2 −0 actionpack/CHANGELOG
  2. +7 −1 actionpack/lib/action_controller/mime_responds.rb
View
2 actionpack/CHANGELOG
@@ -1,3 +1,5 @@
+* Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com]
+
*1.12.3* (June 28th, 2006)
* Fix broken traverse_to_controller. We now:
View
8 actionpack/lib/action_controller/mime_responds.rb
@@ -92,6 +92,12 @@ module InstanceMethods
# Note that you can define your own XML parameter parser which would allow you to describe multiple entities
# in a single request (i.e., by wrapping them all in a single root note), but if you just go with the flow
# and accept Rails' defaults, life will be much easier.
+ #
+ # If you need to use a MIME type which isn't supported by default, you can register your own handlers in
+ # environment.rb as follows.
+ #
+ # Mime::Type.register "image/jpg", :jpg
+ #
def respond_to(*types, &block)
raise ArgumentError, "respond_to takes either types or a block, never bot" unless types.any? ^ block
block ||= lambda { |responder| types.each { |type| responder.send(type) } }
@@ -160,4 +166,4 @@ def respond
end
end
end
-end
+end

0 comments on commit 4fd92b6

Please sign in to comment.