DEV Community

Discussion on: Wrapping JSON-based ActiveRecord attributes with classes

Collapse
 
johanbaaij profile image
Johan Baaij

This looks great. I wonder if your gem is suitable for an array of hashes. Each hash backed by it's own model. I've got a feeling that I have to write my own List type for this.

Collapse
 
dmitrytsepelev profile image
Dmitry Tsepelev

It was impossible earlier but I've just released 0.2.0 which supports this behavior:

class Product < ApplicationRecord
  attribute :configurations, Configuration.to_array_type
end
Enter fullscreen mode Exit fullscreen mode

Thanks for the idea!