Forum: Ruby on Rails ActiveResource noob

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.
997433f165140d58f52b8c0d1d005dc1?d=identicon&s=25 Patrick Aljord (Guest)
on 2007-06-26 00:54
(Received via mailing list)
Hey all,
I've just installed ActiveResource.
Those are my two models:

class Profile < ActiveRecord::Base
  has_many :emails
class Email < ActiveRecord::Base
  belongs_to :profile

My routes.rb file:

  map.resources :emails
map.resources :profiles do |p|
    p.resources :emails

those are my client site models:

class Profile < ActiveResource::Base = ""

class Email < ActiveResource::Base = ""

From script/console, I can create profiles and emails fine.
But when I try to do something like:
p=Profile.find 1

it returns an error that emails function doesn't exist but I think
this is normal RESTful behaviour right?
What's the RESTful way to do it?

I also tried something like:

Email.find :all, :profile_id=>2

but it returns all the profiles any way.

How can I do custom find queries the restful way?

thanx in advance

This topic is locked and can not be replied to.