JSON dynamic attributes with Rails

We had a tricky problem. We knew that the columns for one particular model would need to change over time. That was easily solved with a JSON field, but we also wanted to support validations on this field – validations that are assigned to the model at the time of creation. Example: Yesterday we created a valid Vehicle record with only a name. Today, we add a new brand field. All new Vehicles must have it. If we now reopen yesterday’s record we still want it to be valid.

Continue reading “JSON dynamic attributes with Rails”