Sha256: bc73bfea8c8808f46a5b27d18ec66965464047eb96a21d066851f49df9c77af0
Contents?: true
Size: 954 Bytes
Versions: 4
Compression:
Stored size: 954 Bytes
Contents
require "infopark_component_cache/consistency_guard" module InfoparkComponentCache # @author Tomasz Przedmojski <tomasz.przedmojski@infopark.de> # # @abstract # This abstract class enables the implementing classes # to access the cms and read the current state. # # It also provides the option to limit the object classes # used for lookup. class CmsStateGuard < ConsistencyGuard class << self # This parameter should be initialized to the root Obj # class of the project attr_accessor :obj_root_class end protected # This method implements scoping on the root Obj class # and additional constraints for limiting object classes # used for lookup def scoped_relation if self.options[:obj_classes].present? conditions = {obj_class: self.options[:obj_classes]} else conditions = {} end CmsStateGuard.obj_root_class.where(conditions) end end end
Version data entries
4 entries across 4 versions & 1 rubygems