Forum: Ruby on Rails Custom MIME type syntax

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Daniel S. (Guest)
on 2006-12-31 01:42
(Received via mailing list)
Hello there,

I'm new here, and so may not have be aware of any previous discusion on
this particular topic, but the lack of results when googling has led me
to believe there has been none.

Currently, the custom MIME type sytax is as follows:

  respond_to do |format|
    format.xml do
      # ...

    format.js do
      # ...

What I do not understand is why the following syntax should not be used

  case format
  when :xml
    # ...
  when :js
    # ...

This would mean defining a #format method that returned the name of the
negotiated content type.

This topic is locked and can not be replied to.