Use Storext (or just Virtus) with nested array or hash objects
问题 I have a postgres DB backing my Rails app with a class with a jsonb column class Product < AR::B include Storext.model(data: {}) store_attributes :data do thing_one String thing_two Boolean # Not actually showing up in the `data` hash foos FooCollection[Foo] end end class FooCollection < Array def <<(obj) if Hash super(Coupon.new(obj) else # Other coersions end end end class Foo include Storext.model attribute :id, Integer attribute :price, Float attribute :regular_price, Float end But Foo in