I have a class TrafficRule
that is defined like this:
TrafficRule
- name:string
- type:string
- details:text
The details
parameter will be a JSON object that will store a set of details for a given traffic rule, and the type
parameter will define what that JSON object looks like. So for one rule type the object might be an array, and for another the object might be a hash. I would like the TrafficRule STI class to define what the details object looks like.
Has anyone come across a design pattern that solves this use case well? Maybe I need to change the way my objects are associated?
Ideally, I would love to be able to edit this object in ActiveAdmin and have the form actually customize for the type of input that it's expecting.
:json
without needing to add aserialize
declaration. – tadman