Sha256: da1c0490b3ccde947c3f1040383c17b9b740433a8db34914f750f3c6adac5084
Contents?: true
Size: 961 Bytes
Versions: 1
Compression:
Stored size: 961 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.scoped.where(conditions) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
infopark_component_cache-2.0.0 | lib/infopark_component_cache/guards/cms_state_guard.rb |