lib/querifier/queries/where.rb in querifier-0.1.1 vs lib/querifier/queries/where.rb in querifier-0.2.2
- old
+ new
@@ -7,11 +7,11 @@
@collection
end
def filter
return self if @filtered
- filter_params.each do |attribute|
+ filter_params.each do |(attribute, _)|
value = filter_value(attribute)
send("filter_by_#{attribute}", value) if value
end
@filtered = true
self
@@ -48,11 +48,16 @@
module ClassMethods
@@where_attributes = []
def where_attributes(*value)
- return @@where_attributes = [*value] if value.any?
- @@where_attributes
+ return class_variable_set :@@where_attributes, [*value] if value.any?
+ begin
+ class_variable_get :@@where_attributes
+ rescue NameError
+ class_variable_set :@@where_attributes, []
+ class_variable_get :@@where_attributes
+ end
end
end
end
end
end