June 11, 2006

Posted by John

Older: Plugin: Manage Fixtures

Newer: Hash Goodness

Parameter Driven Response-Type Determination

So edge rails has some severe new sweetness. DHH announced a while ago that Rails 1.1 would respond to the HTTP-accept header
thus allowing each action to respond differently based on what was being requested. Changeset 4384 adds on to that feature by making it possible to change the accept type by passing a parameter named format in the url.

For example, http://www.domain.com/action would return html. However, if you changed that request to http://www.domain.com/action?format=xml, Rails now overrides the default text/html accept header that the browser sends and responds with xml. Check out the changeset for more information.


Thoughts? Do Tell...

textile enabled, preview above, please be nice
use <pre><code class="ruby"></code></pre> for code blocks


Authored by John Nunemaker (Noo-neh-maker), a web developer and programmer who has fallen deeply in love with Ruby. More about John.


Feed IconRailsTips Articles - An assortment of howto's and thoughts on Ruby and Rails.

Feed IconRails Quick Tips - Ruby and Rails related links.