static public Method

Base.format=(mime_type_reference_or_format)

Sets the format that attributes are sent and received in from a mime type reference. Example:

Person.format = :json
Person.find(1) # => GET /people/1.json

Person.format = ActiveResource::Formats::XmlFormat
Person.find(1) # => GET /people/1.xml

Default format is :xml.

Source Code

# File active_resource/base.rb, line 190
def format=(mime_type_reference_or_format)
  format = mime_type_reference_or_format.is_a?(Symbol) ? 
    ActiveResource::Formats[mime_type_reference_or_format] : mime_type_reference_or_format

  write_inheritable_attribute("format", format)
  connection.format = format if site
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.