ActiveResource find method and restful controllers.


What's the best way to add support for the activeresource find method
in the controllers in my rails app?

As I understand it when you invoke something like:
Person.find(:all, :params => {:name = 'toby'})

this generates a request of:
GET /people.xml?name=toby

Does this mean that in my index method in PeopleController in my rails
app I have params[name] set to toby?

What is the best was of returning useful data from this find from
within my controller i.e., how do I construct a find in the


Ok so after a bit of playing I can answer half of my question but I
have also come up with what seems to be a problem with activeresource.

By invoking Person.find(:all, :params => {:name => 'toby'}) a request
of GET /people.xml?name=toby is created and then in the controller
this appears in the params hash as params[:name]

Currently I am using the following code in my controller but I don't
think it is a very way to do what I want to do:

def index
  if params[:name]
    @people = Person.find(:first, :conditions => ["name = ?",
    raise(ActiveRecord::RecordNotFound, "Couldn't find person with
name #{params[:name]}") unless @people
    @data_dates = People.find(:all)

  respond_to do |format|
    format.xml { render :xml => @people }

Unfortunately at the activeresource end this generates the error

NoMethodError: undefined method `collect!' for #<Hash:0xb12ab325>

I found this ticket but after applying the patch I still have the same

If anyone has any suggestion at all I would be grateful as I am pretty
lost now...