hmmm, you don't give enough information.
What's the registration about?
Is this for some kind of car rental service?
I sure didn't. 3:30am was late for me.
It is a warranty registration where many different products need to be
registered. Each product shares some of the same characteristics,
date_registered, dealer_purchased_from, etc... those are kept in the
registrations table. But each has it's own unique qualities that we
need to track. Perhaps a serial_number and model_number and
power_pack_sn for one product. The other might have a serial_number
and a blade_sn, for instance.
The way you describe it, a car could only belong to a single
Another thing missing is the customer who makes the registration.
If it's like a car rental, then the registration should be polymorphic
and either belong to a car or motorcycle.
belongs_to :registrateable, :polymorphic => true
# it needs a registrateable_id column in which you store the car or
# and a registrateable_type column in which Rails stores the class
Can you say registrateable? I'm not native english, maybe there is
a better word? registerable?
Registerable is in fact a word.
Cars and motorcycles each get:
has_many :registrations, :as => :registrateable
This way you could get as many links between customers and cars as you
I don't think this relationship would work. Because we are dealing
with serialized inventory. So product A is really an assembly that
consists of several different serialized parts and can only be
registered once to 1 customer. Product B is also an assembly that
consists of several different serialized parts that can only be
registered to a single customer. The customer can have many different
products all with unique registrations. Does that help?