searchlogic 2.3.13 → 2.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/searchlogic/named_scopes/or_conditions.rb +3 -3
- data/searchlogic.gemspec +1 -1
- metadata +1 -1
data/VERSION.yml
CHANGED
@@ -123,16 +123,16 @@ module Searchlogic
|
|
123
123
|
scope = named_scope_options(scopes.first)
|
124
124
|
column_type = scope.respond_to?(:searchlogic_arg_type) ? scope.searchlogic_arg_type : :string
|
125
125
|
named_scope scopes.join("_or_"), searchlogic_lambda(column_type) { |*args|
|
126
|
-
merge_scopes_with_or(scopes.collect { |scope| send(scope, *args) })
|
126
|
+
merge_scopes_with_or(scopes.collect { |scope| clone.send(scope, *args) })
|
127
127
|
}
|
128
128
|
end
|
129
129
|
|
130
130
|
def merge_scopes_with_or(scopes)
|
131
|
-
scopes_options = scopes.collect { |scope| scope.
|
131
|
+
scopes_options = scopes.collect { |scope| scope.scope(:find) }
|
132
132
|
conditions = scopes_options.reject { |o| o[:conditions].nil? }.collect { |o| sanitize_sql(o[:conditions]) }
|
133
133
|
scope = scopes_options.inject(scoped({})) { |current_scope, options| current_scope.scoped(options) }
|
134
134
|
options = scope.scope(:find)
|
135
|
-
options.delete(:readonly) unless scope.proxy_options.key?(:readonly)
|
135
|
+
options.delete(:readonly) unless scopes.any? { |scope| scope.proxy_options.key?(:readonly) }
|
136
136
|
options.merge(:conditions => "(" + conditions.join(") OR (") + ")")
|
137
137
|
end
|
138
138
|
end
|
data/searchlogic.gemspec
CHANGED