I have some models like so:
items (id, name)
attributes (id, name, datatype)
items_attributes (id, item_id, attribute_id, value)
I want to create attributes and assign types to it like decimal, varchar and such
Then when storing the _joined data. I want to perform validation on the joined data.
I want to store the validation type in database under attributes (attributes.datatype)
Then when a save is performed there is validation based on the information stored in attributes table.
How would I go about doing this? I need to use an event beforeSave and then create validation rules?
Any suggestions or examples of how this can be done?