This project is archived and is in readonly mode.

#1114 ✓stale

Format extensions (.xml or .json) should be optional in request urls generated in ActiveResource

Reported by rbpandey | September 25th, 2008 @ 07:21 PM | in 3.x

Per REST, the http request headers provide the definitive information on what type of data to return ie "Accept:application/json" or "Accept:application/xml", so adding this information to the request urls should be optional. I added a configuration option to do so ie ActiveResource::Base.use_format_extension = false.

This patch maintains backwards-compatibility and by-default continues to build urls which include the format extensions. You can turn off the extensions in the urls by doing something like

Person.use_format_extension = false


class FooBar < ActiveResource::Base self.use_format_extension = false end

Comments and changes to this ticket

  • Pratik

    Pratik January 5th, 2009 @ 06:35 PM

    Looks good. The patch is missing docs.

  • rbpandey
  • rbpandey

    rbpandey January 6th, 2009 @ 05:56 PM

    Pratik, can you also have a look at tickets 1150 and 1098 here

    Thx, rbp

  • rbpandey

    rbpandey January 29th, 2009 @ 04:17 PM

    Just wanted to touch this as a reminder that the patch was updated recently to include the requested documentation and rebased...

  • Ryan Bigg

    Ryan Bigg April 10th, 2010 @ 11:45 AM

    • Assigned user set to “Pratik”

    Seems like your move on this one Pratik.

  • Nathaniel Bibler

    Nathaniel Bibler April 11th, 2010 @ 03:57 AM

    Just a word of warning that relying on Accept headers alone may be quite misleading. Both Internet Explorer (pretty much all versions) and Webkit-based browsers often have incorrect Accept request headers.

    Webkit actually prefers (or at least did if it hasn't yet been patched) XML before XHTML before HTML for general requests. And IE is just, well, retarded about life and Accepts image formats and even application/msword MIMEs before HTML. Way to go, IE.

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 05:04 PM

    • State changed from “new” to “open”
    • Importance changed from “” to “”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 05:04 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket