Topic: Shared behaviour and unified searching of similar models
I have been pondering this for a couple of weeks now and I thought it was time I roped in some help. By the way I have another account on RailsForum, I work for one company part time, this a new account for my other stuff!
I have a design for a CMS, each different kind of asset has a model, so we have models for Article, Picture, Song, Product and a few others. Now each of these models has shared behavior, for example the are a number of common fields such as title, description, author_id, published_on, as well associations such as has_one :folder and has_many :tags.
My question is kind of two fold. Firstly I need to work out the best place to put the shared behavior, normally I would use standard Object Inheritance, but the Rails way seems to be the use of a mixin module (ie. acts_as) which is fine. Secondly I need a way to search all the assets at once using the common fields (title, description etc.), my thinking is to have a model call Asset with the common fields plus a field to hold the asset type (eg. Article) and the id of that asset [just like a polymorphic join].
Does this sound like a good plan?