Topic: Domain design question...

OK, I have a domain design question...

I'm making an 'album review' site.  I'm trying to make these reviews based on a simple blog structure.  So when you go to submit the review you have to choose what type of post it will be (normal or review).  When you choose review some code unhides that cooresponds to reviews (like group, album, label, etc.) from the ALBUMREVIEW table.

So my problem is that I'm having difficulty with relating the BLOGITEM (a basic table for blog info) and the ALBUMREVIEW data. 

I want to say an ALBUMREVIEW belongs_to :blogitem.  And "BLOGITEM has_one :albumreview".  Problem is that this is not proper rails code.  Only one review should ever be associated with a blog post.  Having multiple reviews in a single blog post would not make sense.

So this is really a 1 to 1 relationship, but I'm not sure how to convey that.  A blog post should be able to link to an album review, but belonging to an albumreview wouldn't make sense either because many blog posts will not be album reviews. 

So I'm thinking that the idea that BLOGITEM has_many :albumreviews works as long as I restrict my code to only allow for one review to be added within that blog post.

Does this make any sense at all?  Sorry, I'm pretty new to this all so if this is a dumb question please forgive me.

-BT

Re: Domain design question...

has_one is valid in Rails. Is there a reason you don't want to use this?

Railscasts - Free Ruby on Rails Screencasts

Re: Domain design question...

ryanb wrote:

has_one is valid in Rails. Is there a reason you don't want to use this?

haha, I didn't know that.  My primary rails book doesn't cover it so I didn't think it existed.
So that would answer my question.

Thanks,
-BT