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"
end
class Email < ActiveResource::Base
self.site = "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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---