# ActiveResource noob

**URL:** <https://www.ruby-forum.com/t/activeresource-noob/107763>\
**Category:** Rails\
**Created:** [June 26, 2007, 12:54am UTC](https://www.ruby-forum.com/t/activeresource-noob/107763 "2007-06-26T00:54:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [June 26, 2007, 12:54am UTC](https://www.ruby-forum.com/t/activeresource-noob/107763/1 "2007-06-26T00:54:58Z")

</div>

Hey all,  
I’ve just installed ActiveResource.  
Those are my two models:

class Profile \< ActiveRecord::Base  
has\_many :emails  
end  
class Email \< ActiveRecord::Base  
belongs\_to :profile  
end

My routes.rb file:

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

those are my client site models:

class Profile \< ActiveResource::Base  
self.site = “[http://0.0.0.0:3000](http://0.0.0.0:3000)”  
end

class Email \< ActiveResource::Base  
self.site = “[http://0.0.0.0:3000](http://0.0.0.0:3000)”  
end

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

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

Pat
