Class

Mime::Type

Inheritance
< Object

Encapsulates the notion of a mime type. Can be used at render time, for example, with:

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

      respond_to do |format|
        format.html
        format.ics { render :text => post.to_ics, :mime_type => Mime::Type["text/calendar"]  }
        format.xml { render :xml => @people.to_xml }
      end
    end
  end

Methods

Class

Visibility Signature
public lookup (string)
public lookup_by_extension (extension)
public new (string, symbol = nil, synonyms = [])
public parse (accept_header)
public register (string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)
public register_alias (string, symbol, extension_synonyms = [])
public unverifiable_types ()

Instance

Visibility Signature
public == (mime_type)
public === (list)
public =~ (mime_type)
public browser_generated? ()
public html? ()
public to_s ()
public to_str ()
public to_sym ()
public verify_request? ()

Class Method Detail

lookup(string)

lookup_by_extension(extension)

new(string, symbol = nil, synonyms = [])

parse(accept_header)

register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)

register_alias(string, symbol, extension_synonyms = [])

Registers an alias that‘s not used on mime type lookup, but can be referenced directly. Especially useful for rendering different HTML versions depending on the user agent, like an iPhone.

unverifiable_types()

Instance Method Detail

==(mime_type)

===(list)

=~(mime_type)

browser_generated?()

html?()

to_s()

to_str()

to_sym()

verify_request?()

Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See ActionController::RequestForgeryProtection.