require 'fiona7/super_id_finder' require 'fiona7/attribute_names_from_cms' module Fiona7 class ReferencedIdFinder def initialize(fields=[], connection=::Fiona7::WriteObj.connection, instance_name=RailsConnector::CmsBaseModel.instance_name) fields = fields.map {|f| Fiona7::AttributeNamesFromCms.new(f).attributes }.flatten forbidden = Fiona7::ForbiddenObjClasses.new.call @id_finder = Fiona7::SuperIdFinder.new( forbidden, fields, connection, instance_name ) end def find(klass, ids) @id_finder.find( klass == Fiona7::ReleasedObj ? :live : :preview, ids ) end end end