class

Mime::Type

v1.1.6 - Show latest stable - Superclass: Object

No documentation available for this class.

Files

  • actionpack/lib/action_controller/mime_type.rb

Nested classes and modules

1Note

Setting a custom Content type

schmidt ยท Nov 3, 2009

The given example seems to be broken. The +:mime_type+ option as well as the [] access on the Mime::Type class are both not working.

The following code allows the custom setting of content types as intended by the original example:

class  PostsController < ActionController::Base
def show
   @post = Post.find(params[:id])

  respond_to do |format|
    format.html
    format.ics { render :text => post.to_ics, :content_type => Mime::Type.lookup("text/calendar")  }
    format.xml { render :xml => @people.to_xml }
  end
end
end