searchlogic 2.3.3 → 2.3.4
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
@@ -15,7 +15,17 @@ module Searchlogic
|
|
15
15
|
# the merge_joins method to delete duplicates.
|
16
16
|
def merge_joins_with_searchlogic(*args)
|
17
17
|
joins = merge_joins_without_searchlogic(*args)
|
18
|
-
joins.collect { |j| j.is_a?(String) ? j.split(" ") : j }.flatten.uniq
|
18
|
+
joins = joins.collect { |j| j.is_a?(String) ? j.split(" ") : j }.flatten.uniq
|
19
|
+
joins = joins.collect do |j|
|
20
|
+
if j.is_a?(String)
|
21
|
+
j.gsub(/(.*) ON (.*) = (.*)/) do |m|
|
22
|
+
sorted = [$2,$3].sort
|
23
|
+
"#{$1} ON #{sorted[0]} = #{sorted[1]}"
|
24
|
+
end
|
25
|
+
else
|
26
|
+
j
|
27
|
+
end
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
21
31
|
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.4"
|
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-09-
|
12
|
+
s.date = %q{2009-09-12}
|
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 = [
|
@@ -131,4 +131,11 @@ describe "Association Conditions" do
|
|
131
131
|
User.named_scope(:orders_big_id, :joins => User.inner_joins(:orders))
|
132
132
|
Company.users_orders_big_id.proxy_options.should == {:joins=>[" INNER JOIN \"users\" ON users.company_id = companies.id ", " INNER JOIN \"orders\" ON orders.user_id = users.id "]}
|
133
133
|
end
|
134
|
+
|
135
|
+
it "should order the join statements ascending by the fieldnames so that we don't get double joins where the only difference is that the order of the fields is different" do
|
136
|
+
company = Company.create
|
137
|
+
user = company.users.create(:company_id => company.id)
|
138
|
+
company.users.company_id_eq(company.id).should == [user]
|
139
|
+
end
|
140
|
+
|
134
141
|
end
|
@@ -292,4 +292,10 @@ describe "Conditions" do
|
|
292
292
|
User.company_id_null.count.should == 1
|
293
293
|
User.company_id_not_null.count.should == 0
|
294
294
|
end
|
295
|
+
|
296
|
+
it "should fix bug for issue 26" do
|
297
|
+
count1 = User.id_ne(10).username_not_like("root").count
|
298
|
+
count2 = User.id_ne(10).username_not_like("root").count
|
299
|
+
count1.should == count2
|
300
|
+
end
|
295
301
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,7 +6,7 @@ require 'activerecord'
|
|
6
6
|
ENV['TZ'] = 'UTC'
|
7
7
|
Time.zone = 'Eastern Time (US & Canada)'
|
8
8
|
|
9
|
-
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :
|
9
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
10
10
|
ActiveRecord::Base.configurations = true
|
11
11
|
|
12
12
|
ActiveRecord::Schema.verbose = false
|
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.4
|
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-09-
|
12
|
+
date: 2009-09-12 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|