ActiveResource noob

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs