If I understand your challenge correctly, the following methods should provide you with what you're after (the nearest upstream non-empty ProductDetails collection).
class Product > ActiveRecord::Base
def parent
@parent ||= Product.where(identifier: self.parent_identifier).first
end
def parent_product_details
return unless parent
upstream_details = parent.product_details
upstream_details = parent.parent_product_details if upstream_details.empty?
upstream_details
end
end
Let me know if I've misunderstood the problem.