This project is archived and is in readonly mode.

#4348 ✓stale
Jamis Buck

Supporting singleton resources in ActiveResource

Reported by Jamis Buck | April 8th, 2010 @ 07:24 PM

Currently, if you indicate that a resource is a singleton in your routes, there is no way (short of monkeypatching ActiveResource) to access that resource via ActiveResource.

This patch adds support for a "singleton" macro, that lets you declare that a particular model maps to a singleton resource:

  class Status < ActiveResource::Base
    # ...

You can then access that singleton resource via a bare "find" call (without arguments):

  current_status = Status.find
  current_status.description = "Code red!"


The attached patch includes tests.

Comments and changes to this ticket

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>

Shared Ticket Bins