In earlier versions of Rails it was possible to add dynamic attributes to a model without the need for there to be an SQL column. The following code worked pre 4.0.
drow = dtab1.drows.create()
drow.write_attribute('value1', 'xxx')
drow.write_attribute('value2', 'yyy')
drow.write_attribute('value3', 'zzz')
But now in v5 I get:
ActiveModel::MissingAttributeError: can't write unknown attribute `value1`
Is there any way to do that now?
Other answers have proposed predefined accessors or replacing the dynamic fields by a "user variables" hash, but that won't work for my situation. They need to be truly dynamic, created at runtime and treated as part of the model.