I'm a newbie to RoR - I have three models: Customer
, Job
and Note
. Customers have Jobs, and both Customers and Jobs can have Notes. Is there a special way to handle this type of relationship in Rails, or will it work if I just have a normal belongs_to relationship with Note?
The issue that concerns me is the note having fields for both customer_id
and job_id
but only a single one will ever be used for a single record (i.e. a specific Note can refer to either a Job or a Customer, but never both), and it doesn't feel like good database design to have a column that will be null half of the time.
Am I over thinking this, or is there something that's not clear to me?