require 'set' require 'fiona7/json/obj_decorator' module Fiona7 WriteObj = RailsConnector::AbstractObj class WriteObj BLACKLISTED_CLASSES = Set[ 'RailsConnector::BasicObj', 'RailsConnector::AbstractObj', 'Fiona7::WriteObj', 'Fiona7::EditedObj', 'Fiona7::ReleasedObj', 'Fiona7::InternalReleasedObj' ] self.configure_for_content(:edited) # disable STI if Fiona7.mode == :standalone # In standalone mode Obj belongs to scrivito # hence no inheritance self.inheritance_column = :_type_disabled def self.descends_from_active_record? true end else # If this method returns true no STI handling occurs def self.descends_from_active_record? super || BLACKLISTED_CLASSES.include?(self.name) end # xxxWidget < Scrivito::BasicWidget clashes with obj STI def self.subclass_from_attributes(attrs) subclass_name = attrs.with_indifferent_access[inheritance_column] if subclass_name.present? && subclass_name != self.name subclass = subclass_name.safe_constantize return subclass if subclass && descendants.include?(subclass) end end end # TODO: use this to simulate deleted objects #default_scope { where('suppress_export != 0') } self.logger = Logger.new(nil) include RailsConnector::Meta include Reactor::Legacy::Base include Reactor::Attributes::Base include Reactor::Persistence::Base include Reactor::Validations::Base include Reactor::Permission::Base include Reactor::Workflow::Base include Reactor::StreamingUpload::Base end end