I’m trying to map Rails to an existing schema, and having a bit of a
time of it.
I’ve got a table Content, and I’ve got a table Review, which is a type
of content. So content has an ‘id’ field, and Review has a ‘contentid’
field. Not all Content has a Review, but all Reviews have exactly one
How do I represent this? I’ve got a Review object, but if I say
“has_one :content” then it goes looking for a review_id key on my
content object, for which it has none. But if I say that Content
has_one :review, and Review :belongs_to content, then all I get when
loading a Review is a nil Content object. I think I’m probably on the
right track there, but missing a key bit of info.
Anybody able to help me unwind this? The app I’m writing primarily
works on the Review objects (and will thus find/edit/update those), and
needs to join over to Content just for a couple of bits of meta data.