Skip to content

Commit

Permalink
Added Mime::TEXT (text/plain) and Mime::ICS (text/calendar) as new de…
Browse files Browse the repository at this point in the history
…fault types [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4406 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Jun 2, 2006
1 parent 984aa7e commit 5240d7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*SVN*

* Added Mime::TEXT (text/plain) and Mime::ICS (text/calendar) as new default types [DHH]

* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types [DHH]. Example: Mime::Type.register("image/gif", :gif)

* Added support for Mime objects in render :content_type option [DHH]. Example: render :text => some_atom, :content_type => Mime::ATOM
Expand Down
5 changes: 5 additions & 0 deletions actionpack/lib/action_controller/mime_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def ==(mime_type)
end

ALL = Type.new "*/*", :all
TEXT = Type.new "text/plain", :text
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
Expand All @@ -130,6 +131,8 @@ def ==(mime_type)

LOOKUP["*/*"] = ALL

LOOKUP["text/plain"] = TEXT

LOOKUP["text/html"] = HTML
LOOKUP["application/xhtml+xml"] = HTML

Expand All @@ -155,6 +158,8 @@ def ==(mime_type)
EXTENSION_LOOKUP["html"] = HTML
EXTENSION_LOOKUP["xhtml"] = HTML

EXTENSION_LOOKUP["txt"] = TEXT

EXTENSION_LOOKUP["xml"] = XML

EXTENSION_LOOKUP["js"] = JS
Expand Down

0 comments on commit 5240d7a

Please sign in to comment.