I’m attempting to convert a legacy application.
I need to do what amounts to a “alias filter” on a table.
The table - call it ‘Assets’ - has many name-value pairs as its public
It is shared by many other tables, so the key is
This is a one-way association: “Assets of X”, where “X” can be another
In base SQL this is easy - set up an alias
My Question- ow to do this in Rails:
Is there a way to filter for a ‘parent’ class so this can be shared?
Class OneThing < AR::B
has_many :assets # where asset.parent_class = ‘OneThing’
Class AnotherThing < AR::B
has_many :assets # where asset.parent_class = ‘AnotherThing’
So how to make this ‘automated’ for the CRUD and how to define the
class? Can ‘Asset’ somehow belong_to more than one model?
I’ve no problem drawing the E-R diagram
or thinking what the explicit and long winded SQL would be,
but I don’t have the Rail experience to see this.
I can see docco on ‘has_and_belongs_to_many’ using an intermediate join
table, but this is a one way association.
A seminar on time-travel will be held two weeks ago.