searchlogic 2.3.2 → 2.3.3
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/CHANGELOG.rdoc +5 -1
- data/VERSION.yml +2 -2
- data/lib/searchlogic/named_scopes/or_conditions.rb +13 -3
- data/searchlogic.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
data/VERSION.yml
CHANGED
@@ -96,11 +96,21 @@ module Searchlogic
|
|
96
96
|
|
97
97
|
def create_or_condition(scopes, args)
|
98
98
|
named_scope scopes.join("_or_"), lambda { |*args|
|
99
|
-
|
100
|
-
conditions = scopes_options.reject { |o| o[:conditions].nil? }.collect { |o| sanitize_sql(o[:conditions]) }
|
101
|
-
scopes.inject(scoped({})) { |scope, scope_name| scope.send(scope_name, *args) }.scope(:find).merge(:conditions => "(" + conditions.join(") OR (") + ")")
|
99
|
+
merge_scopes_with_or(scopes.collect { |scope| [scope, *args] })
|
102
100
|
}
|
103
101
|
end
|
102
|
+
|
103
|
+
def merge_scopes_with_or(scopes)
|
104
|
+
scopes_options = scopes.collect { |scope, *args| send(scope, *args).proxy_options }
|
105
|
+
conditions = scopes_options.reject { |o| o[:conditions].nil? }.collect { |o| sanitize_sql(o[:conditions]) }
|
106
|
+
|
107
|
+
scope = scopes.inject(scoped({})) do |scope, info|
|
108
|
+
scope_name, *args = info
|
109
|
+
scope.send(scope_name, *args)
|
110
|
+
end
|
111
|
+
|
112
|
+
scope.scope(:find).merge(:conditions => "(" + conditions.join(") OR (") + ")")
|
113
|
+
end
|
104
114
|
end
|
105
115
|
end
|
106
116
|
end
|
data/searchlogic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{searchlogic}
|
8
|
-
s.version = "2.3.
|
8
|
+
s.version = "2.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Johnson of Binary Logic"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-09-02}
|
13
13
|
s.description = %q{Searchlogic makes using ActiveRecord named scopes easier and less repetitive.}
|
14
14
|
s.email = %q{bjohnson@binarylogic.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchlogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Johnson of Binary Logic
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|