binarylogic-searchlogic 2.3.2 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- 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 +3 -4
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: binarylogic-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 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -66,7 +66,6 @@ files:
|
|
66
66
|
- spec/spec_helper.rb
|
67
67
|
has_rdoc: false
|
68
68
|
homepage: http://github.com/binarylogic/searchlogic
|
69
|
-
licenses:
|
70
69
|
post_install_message:
|
71
70
|
rdoc_options:
|
72
71
|
- --charset=UTF-8
|
@@ -87,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
86
|
requirements: []
|
88
87
|
|
89
88
|
rubyforge_project: searchlogic
|
90
|
-
rubygems_version: 1.
|
89
|
+
rubygems_version: 1.2.0
|
91
90
|
signing_key:
|
92
91
|
specification_version: 3
|
93
92
|
summary: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
|