lib/querifier/queries/base.rb in querifier-0.1.1 vs lib/querifier/queries/base.rb in querifier-0.2.2
- old
+ new
@@ -5,11 +5,11 @@
@params = params
check_params!
end
def collection
- @collection ||= self.class.entity_class.all
+ @collection ||= self.class.default_collection
end
def params
@params.fetch(Config.filter_param, {})
end
@@ -17,16 +17,11 @@
def self.included(klass)
klass.extend(ClassMethods)
end
module ClassMethods
- def entity_class(value = nil)
- return entity_class = value unless value.nil?
- @@entity_class ||= Object.const_get self.name.split('::').last.split('Query').first
- end
-
- def entity_class=(value)
- @@entity_class = value
+ def default_collection
+ @@default_collection ||= Object.const_get(self.name.split('::').last.split('Query').first).all
end
end
private