Let's say I'm writing a Library application for a publishing company who already has a People application.
So in my Library application I have
class Person < ActiveResource::Base
self.site = "http://api.people.mypublisher.com/"
end
and now I want to store Articles for each Person:
class Article < ActiveRecord::Base
belongs_to :person, :as => :author
end
I imagine I'd have the following table in my database:
Articles
id (PK) | title (string) | body (text) | author_id (integer)
author_id isn't exactly a Foreign-Key, since I don't have a People table. That leaves several questions:
how do I tell my
PersonActiveResourceobject that ithas_manyArticles?Will
Articles.find(:first).authorwork? Willbelongs_toeven work given that there's noActiveRecordand no backing table?