Closed dhruv-shipmnts closed 2 years ago
What you desire can be accomplished using the following code example:
class B < ApplicationRecord
has_many :c_items
end
class A < ApplicationRecord
has_many :b_items
has_snapshot_children do
instance = self.class.includes(:comments, :ip_address).find(id)
{
b_items: b_items,
c_items: b_items.flat_map{|x| x.c_items },
}
end
end
Let's say Model A -> has many B -> has many C How to generate a snapshot having details of A, B, and C all 3?