searchlogic 2.4.31 → 2.4.32
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
CHANGED
|
@@ -7,13 +7,13 @@ module Searchlogic
|
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def send_with_searchlogic(method, *args)
|
|
10
|
+
def send_with_searchlogic(method, *args, &block)
|
|
11
11
|
# create the scope if it doesn't exist yet, then delegate back to the original method
|
|
12
12
|
if !proxy_respond_to?(method) && proxy_reflection.macro != :belongs_to && !proxy_reflection.options[:polymorphic] && proxy_reflection.klass.condition?(method)
|
|
13
|
-
proxy_reflection.klass.send(method, *args)
|
|
13
|
+
proxy_reflection.klass.send(method, *args, &block)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
send_without_searchlogic(method, *args)
|
|
16
|
+
send_without_searchlogic(method, *args, &block)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -157,9 +157,17 @@ module Searchlogic
|
|
|
157
157
|
searchlogic_lambda(column.type, :skip_conversion => options[:skip_conversion]) { |*values|
|
|
158
158
|
unless values.empty?
|
|
159
159
|
if equals && any
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
has_nil = values.include?(nil)
|
|
161
|
+
values = values.flatten.compact
|
|
162
|
+
sql = attribute_condition("#{table_name}.#{column.name}", values)
|
|
163
|
+
subs = [values]
|
|
164
|
+
|
|
165
|
+
if has_nil
|
|
166
|
+
sql += " OR " + attribute_condition("#{table_name}.#{column.name}", nil)
|
|
167
|
+
subs << nil
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
{:conditions => [sql, *subs]}
|
|
163
171
|
else
|
|
164
172
|
values.flatten!
|
|
165
173
|
values.collect! { |value| value_with_modifier(value, options[:value_modifier]) }
|
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.4.
|
|
8
|
+
s.version = "2.4.32"
|
|
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{2011-03-
|
|
12
|
+
s.date = %q{2011-03-07}
|
|
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 = [
|
|
@@ -126,6 +126,12 @@ describe Searchlogic::NamedScopes::Conditions do
|
|
|
126
126
|
User.username_equals_any("bjohnson", "thunt").all.should == User.find_all_by_username(["bjohnson", "thunt"])
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
# PostgreSQL does not allow null in "in" statements
|
|
130
|
+
it "should have equals any and handle nils" do
|
|
131
|
+
%w(bjohnson thunt dgainor).each { |username| User.create(:username => username) }
|
|
132
|
+
User.username_equals_any("bjohnson", "thunt", nil).proxy_options.should == {:conditions=>["users.username IN (?) OR users.username IS ?", ["bjohnson", "thunt"], nil]}
|
|
133
|
+
end
|
|
134
|
+
|
|
129
135
|
it "should have equals all" do
|
|
130
136
|
%w(bjohnson thunt dainor).each { |username| User.create(:username => username) }
|
|
131
137
|
User.username_equals_all("bjohnson", "thunt").all.should == []
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: searchlogic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 2.4.
|
|
5
|
+
version: 2.4.32
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Ben Johnson of Binary Logic
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-03-
|
|
13
|
+
date: 2011-03-07 00:00:00 -05:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
103
103
|
requirements:
|
|
104
104
|
- - ">="
|
|
105
105
|
- !ruby/object:Gem::Version
|
|
106
|
-
hash:
|
|
106
|
+
hash: -3829860769572842136
|
|
107
107
|
segments:
|
|
108
108
|
- 0
|
|
109
109
|
version: "0"
|