I have the following type of situation: three different models (X, Y,
Z). There is no relationship between X and Y, but Y should have_many
of Z (although I’m not convinced Z should belong_to Y, and it may even
belong_to both Y and X). Instances of Z are created for specific
combinations of X and Y (ie, Z will likely have the fields x_id and
y_id). Z will also contain a name that will be used as an identifier
for an instance Y to an instance of X.
I’m not sure if I should simply have a has_many/belongs_to
relationship between Y and Z, and then search through this subset for
an instance of X (to identify the instance of Y as Z) or if there is a
more eloquent way to achieve this.
Any thoughts/ideas would be appreciated.