Permalink
Browse files

Added text/csv as a default mime type and included example on how to …

…make your own in config/environment.rb [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5620 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 12949bb commit 694957ce5ad0129c8992b2cc746e9b74bfd1b83b @dhh dhh committed Nov 23, 2006
Showing with 9 additions and 0 deletions.
  1. +5 −0 actionpack/lib/action_controller/mime_type.rb
  2. +4 −0 railties/environments/environment.rb
View
5 actionpack/lib/action_controller/mime_type.rb
@@ -135,6 +135,7 @@ def ==(mime_type)
HTML = Type.new "text/html", :html, %w( application/xhtml+xml )
JS = Type.new "text/javascript", :js, %w( application/javascript application/x-javascript )
ICS = Type.new "text/calendar", :ics
+ CSV = Type.new "text/csv", :csv
XML = Type.new "application/xml", :xml, %w( text/xml application/x-xml )
RSS = Type.new "application/rss+xml", :rss
ATOM = Type.new "application/atom+xml", :atom
@@ -157,6 +158,8 @@ def ==(mime_type)
LOOKUP["text/calendar"] = ICS
+ LOOKUP["text/csv"] = CSV
+
LOOKUP["application/xml"] = XML
LOOKUP["text/xml"] = XML
LOOKUP["application/x-xml"] = XML
@@ -181,6 +184,8 @@ def ==(mime_type)
EXTENSION_LOOKUP["ics"] = ICS
+ EXTENSION_LOOKUP["csv"] = CSV
+
EXTENSION_LOOKUP["yml"] = YAML
EXTENSION_LOOKUP["yaml"] = YAML
View
4 railties/environments/environment.rb
@@ -53,4 +53,8 @@
# inflect.uncountable %w( fish sheep )
# end
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register "application/x-mobile", :mobile
+
# Include your application configuration below

0 comments on commit 694957c

Please sign in to comment.