I have a complex object 'Variant' which has many associations. Something on these lines.
class Spree::Variant
belongs_to :product
has_many :variant_properties
end
class Spree::Product
has_many :variants
has_many :properties
end
On a page I want to display many variant objects which needs all the product/variant associations and properties. I was using elasticsearch earlier to create a unified view which would encapsulate all this data into one object. On variant save, elasticsearch would update its index with the changed mapped values.
Now I wish to remove elasticsearch and fetch all the data via activerecord. but creating the object with all the data would require a lot of database calls.
Is there a way so I can have the de-normalized object using ActiveRecord?