kazjote-searchlogic 2.1.9.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/lib/searchlogic.rb CHANGED
@@ -1,30 +1,37 @@
1
1
  require "searchlogic/core_ext/proc"
2
2
  require "searchlogic/core_ext/object"
3
- require "searchlogic/active_record_consistency"
3
+ require "searchlogic/active_record/consistency"
4
+ require "searchlogic/active_record/named_scopes"
4
5
  require "searchlogic/named_scopes/conditions"
5
6
  require "searchlogic/named_scopes/ordering"
6
7
  require "searchlogic/named_scopes/association_conditions"
7
8
  require "searchlogic/named_scopes/association_ordering"
8
9
  require "searchlogic/named_scopes/alias_scope"
10
+ require "searchlogic/named_scopes/or_conditions"
9
11
  require "searchlogic/search"
10
12
 
11
13
  Proc.send(:include, Searchlogic::CoreExt::Proc)
12
14
  Object.send(:include, Searchlogic::CoreExt::Object)
15
+
16
+ module ActiveRecord # :nodoc: all
17
+ class Base
18
+ class << self; include Searchlogic::ActiveRecord::Consistency; end
19
+ end
20
+ end
21
+
22
+ ActiveRecord::Base.extend(Searchlogic::ActiveRecord::NamedScopes)
13
23
  ActiveRecord::Base.extend(Searchlogic::NamedScopes::Conditions)
14
- ActiveRecord::Base.extend(Searchlogic::NamedScopes::Ordering)
15
24
  ActiveRecord::Base.extend(Searchlogic::NamedScopes::AssociationConditions)
16
25
  ActiveRecord::Base.extend(Searchlogic::NamedScopes::AssociationOrdering)
26
+ ActiveRecord::Base.extend(Searchlogic::NamedScopes::Ordering)
17
27
  ActiveRecord::Base.extend(Searchlogic::NamedScopes::AliasScope)
28
+ ActiveRecord::Base.extend(Searchlogic::NamedScopes::OrConditions)
18
29
  ActiveRecord::Base.extend(Searchlogic::Search::Implementation)
19
30
 
20
31
  # Try to use the search method, if it's available. Thinking sphinx and other plugins
21
32
  # like to use that method as well.
22
33
  if !ActiveRecord::Base.respond_to?(:search)
23
- ActiveRecord::Base.class_eval do
24
- class << self
25
- alias_method :search, :searchlogic
26
- end
27
- end
34
+ ActiveRecord::Base.class_eval { class << self; alias_method :search, :searchlogic; end }
28
35
  end
29
36
 
30
37
  if defined?(ActionController)
data/searchlogic.gemspec CHANGED
@@ -1,13 +1,16 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{searchlogic}
5
- s.version = "2.1.9.3"
8
+ s.version = "2.3.4"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Ben Johnson of Binary Logic"]
9
- s.date = %q{2009-07-16}
10
- s.description = %q{Searchlogic provides common named scopes and object based searching for ActiveRecord.}
12
+ s.date = %q{2009-09-02}
13
+ s.description = %q{Searchlogic makes using ActiveRecord named scopes easier and less repetitive.}
11
14
  s.email = %q{bjohnson@binarylogic.com}
12
15
  s.extra_rdoc_files = [
13
16
  "LICENSE",
@@ -22,13 +25,15 @@ Gem::Specification.new do |s|
22
25
  "VERSION.yml",
23
26
  "init.rb",
24
27
  "lib/searchlogic.rb",
25
- "lib/searchlogic/active_record_consistency.rb",
28
+ "lib/searchlogic/active_record/consistency.rb",
29
+ "lib/searchlogic/active_record/named_scopes.rb",
26
30
  "lib/searchlogic/core_ext/object.rb",
27
31
  "lib/searchlogic/core_ext/proc.rb",
28
32
  "lib/searchlogic/named_scopes/alias_scope.rb",
29
33
  "lib/searchlogic/named_scopes/association_conditions.rb",
30
34
  "lib/searchlogic/named_scopes/association_ordering.rb",
31
35
  "lib/searchlogic/named_scopes/conditions.rb",
36
+ "lib/searchlogic/named_scopes/or_conditions.rb",
32
37
  "lib/searchlogic/named_scopes/ordering.rb",
33
38
  "lib/searchlogic/rails_helpers.rb",
34
39
  "lib/searchlogic/search.rb",
@@ -40,6 +45,7 @@ Gem::Specification.new do |s|
40
45
  "spec/named_scopes/association_conditions_spec.rb",
41
46
  "spec/named_scopes/association_ordering_spec.rb",
42
47
  "spec/named_scopes/conditions_spec.rb",
48
+ "spec/named_scopes/or_conditions_spec.rb",
43
49
  "spec/named_scopes/ordering_spec.rb",
44
50
  "spec/search_spec.rb",
45
51
  "spec/spec_helper.rb"
@@ -48,8 +54,8 @@ Gem::Specification.new do |s|
48
54
  s.rdoc_options = ["--charset=UTF-8"]
49
55
  s.require_paths = ["lib"]
50
56
  s.rubyforge_project = %q{searchlogic}
51
- s.rubygems_version = %q{1.3.4}
52
- s.summary = %q{Searchlogic provides common named scopes and object based searching for ActiveRecord.}
57
+ s.rubygems_version = %q{1.3.5}
58
+ s.summary = %q{Searchlogic makes using ActiveRecord named scopes easier and less repetitive.}
53
59
  s.test_files = [
54
60
  "spec/core_ext/object_spec.rb",
55
61
  "spec/core_ext/proc_spec.rb",
@@ -57,6 +63,7 @@ Gem::Specification.new do |s|
57
63
  "spec/named_scopes/association_conditions_spec.rb",
58
64
  "spec/named_scopes/association_ordering_spec.rb",
59
65
  "spec/named_scopes/conditions_spec.rb",
66
+ "spec/named_scopes/or_conditions_spec.rb",
60
67
  "spec/named_scopes/ordering_spec.rb",
61
68
  "spec/search_spec.rb",
62
69
  "spec/spec_helper.rb"
@@ -1,6 +1,10 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
2
 
3
3
  describe "AliasScope" do
4
+ before(:each) do
5
+ User.alias_scope :username_has, lambda { |value| User.username_like(value) }
6
+ end
7
+
4
8
  it "should allow alias scopes" do
5
9
  User.create(:username => "bjohnson")
6
10
  User.create(:username => "thunt")
@@ -9,11 +9,36 @@ describe "Association Conditions" do
9
9
  Company.users_orders_total_greater_than(10).proxy_options.should == Order.total_greater_than(10).proxy_options.merge(:joins => {:users => :orders})
10
10
  end
11
11
 
12
- it "should not allowed named scopes on non existent association columns" do
12
+ it "should allow the use of foreign pre-existing named scopes" do
13
+ User.named_scope :uname, lambda { |value| {:conditions => ["users.username = ?", value]} }
14
+ Company.users_uname("bjohnson").proxy_options.should == User.uname("bjohnson").proxy_options.merge(:joins => :users)
15
+ end
16
+
17
+ it "should allow the use of deep foreign pre-existing named scopes" do
18
+ pending
19
+ Order.named_scope :big_id, :conditions => "orders.id > 100"
20
+ Company.users_orders_big_id.proxy_options.should == Order.big_id.proxy_options.merge(:joins => {:users => :orders})
21
+ end
22
+
23
+ it "should allow the use of foreign pre-existing alias scopes" do
24
+ User.alias_scope :username_has, lambda { |value| User.username_like(value) }
25
+ Company.users_username_has("bjohnson").proxy_options.should == User.username_has("bjohnson").proxy_options.merge(:joins => :users)
26
+ end
27
+
28
+ it "should not raise errors for scopes that don't return anything" do
29
+ User.alias_scope :blank_scope, lambda { |value| }
30
+ Company.users_blank_scope("bjohnson").proxy_options.should == {:joins => :users}
31
+ end
32
+
33
+ it "should ignore polymorphic associations" do
34
+ lambda { Fee.owner_created_at_gt(Time.now) }.should raise_error(NoMethodError)
35
+ end
36
+
37
+ it "should not allow named scopes on non existent association columns" do
13
38
  lambda { User.users_whatever_like("bjohnson") }.should raise_error(NoMethodError)
14
39
  end
15
40
 
16
- it "should not allowed named scopes on non existent deep association columns" do
41
+ it "should not allow named scopes on non existent deep association columns" do
17
42
  lambda { User.users_orders_whatever_like("bjohnson") }.should raise_error(NoMethodError)
18
43
  end
19
44
 
@@ -101,4 +126,9 @@ describe "Association Conditions" do
101
126
  order = user.orders.create(:total => 20, :taxes => 3)
102
127
  Company.users_orders_taxes_lt(50).ascend_by_users_orders_total.all(:include => {:users => :orders}).should == Company.all
103
128
  end
129
+
130
+ it "should automatically add string joins if the association condition is using strings" do
131
+ User.named_scope(:orders_big_id, :joins => User.inner_joins(:orders))
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
+ end
104
134
  end
@@ -16,4 +16,12 @@ describe "Association Ordering" do
16
16
  it "should allow deep descending" do
17
17
  Company.descend_by_users_orders_total.proxy_options.should == Order.descend_by_total.proxy_options.merge(:joins => {:users => :orders})
18
18
  end
19
+
20
+ it "should ascend with a belongs to" do
21
+ User.ascend_by_company_name.proxy_options.should == Company.ascend_by_name.proxy_options.merge(:joins => :company)
22
+ end
23
+
24
+ it "should work through #order" do
25
+ Company.order('ascend_by_users_username').proxy_options.should == Company.ascend_by_users_username.proxy_options
26
+ end
19
27
  end
@@ -15,6 +15,9 @@ describe "Conditions" do
15
15
  it "should have equals" do
16
16
  (5..7).each { |age| User.create(:age => age) }
17
17
  User.age_equals(6).all.should == User.find_all_by_age(6)
18
+ User.age_equals(nil).all.should == User.find_all_by_age(nil)
19
+ User.age_equals(5..6).all.should == User.find_all_by_age(5..6)
20
+ User.age_equals([5, 7]).all.should == User.find_all_by_age([5, 7])
18
21
  end
19
22
 
20
23
  it "should have does not equal" do
@@ -90,6 +93,16 @@ describe "Conditions" do
90
93
  ["bjohnson", ""].each { |username| User.create(:username => username) }
91
94
  User.username_empty.all.should == User.find_all_by_username("")
92
95
  end
96
+
97
+ it "should have blank" do
98
+ ["bjohnson", "", nil].each { |username| User.create(:username => username) }
99
+ User.username_blank.all.should == [User.find_by_username(""), User.find_by_username(nil)]
100
+ end
101
+
102
+ it "should have not blank" do
103
+ ["bjohnson", "", nil].each { |username| User.create(:username => username) }
104
+ User.username_not_blank.all.should == User.find_all_by_username("bjohnson")
105
+ end
93
106
  end
94
107
 
95
108
  context "any and all conditions" do
@@ -97,6 +110,11 @@ describe "Conditions" do
97
110
  User.username_equals_any.proxy_options.should == {}
98
111
  end
99
112
 
113
+ it "should treat an array and multiple arguments the same" do
114
+ %w(bjohnson thunt dgainor).each { |username| User.create(:username => username) }
115
+ User.username_like_any("bjohnson", "thunt").should == User.username_like_any(["bjohnson", "thunt"])
116
+ end
117
+
100
118
  it "should have equals any" do
101
119
  %w(bjohnson thunt dgainor).each { |username| User.create(:username => username) }
102
120
  User.username_equals_any("bjohnson", "thunt").all == User.find_all_by_username(["bjohnson", "thunt"])
@@ -203,9 +221,6 @@ describe "Conditions" do
203
221
  end
204
222
 
205
223
  it "should have is_not" do
206
- # This is matching "not" first. How do you give priority in a regex? Because it's matching the
207
- # 'not' condition and thinking the column is 'age_is'.
208
- pending
209
224
  User.age_is_not(5).proxy_options.should == User.age_does_not_equal(5).proxy_options
210
225
  end
211
226
 
@@ -273,5 +288,8 @@ describe "Conditions" do
273
288
 
274
289
  it "should have priorty to columns over conflicting association conditions" do
275
290
  Company.users_count_gt(10)
291
+ User.create
292
+ User.company_id_null.count.should == 1
293
+ User.company_id_not_null.count.should == 0
276
294
  end
277
295
  end
@@ -0,0 +1,36 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe "Or conditions" do
4
+ it "should match username or name" do
5
+ User.username_or_name_like("ben").proxy_options.should == {:conditions => "(users.name LIKE '%ben%') OR (users.username LIKE '%ben%')"}
6
+ end
7
+
8
+ it "should use the specified condition" do
9
+ User.username_begins_with_or_name_like("ben").proxy_options.should == {:conditions => "(users.name LIKE '%ben%') OR (users.username LIKE 'ben%')"}
10
+ end
11
+
12
+ it "should use the last specified condition" do
13
+ User.username_or_name_like_or_id_or_age_lt(10).proxy_options.should == {:conditions => "(users.age < 10) OR (users.id < 10) OR (users.name LIKE '%10%') OR (users.username LIKE '%10%')"}
14
+ end
15
+
16
+ it "should raise an error on unknown conditions" do
17
+ lambda { User.usernme_begins_with_or_name_like("ben") }.should raise_error(Searchlogic::NamedScopes::OrConditions::UnknownConditionError)
18
+ end
19
+
20
+ it "should work well with _or_equal_to" do
21
+ User.id_less_than_or_equal_to_or_age_gt(10).proxy_options.should == {:conditions => "(users.age > 10) OR (users.id <= 10)"}
22
+ end
23
+
24
+ it "should work well with _or_equal_to_any" do
25
+ User.id_less_than_or_equal_to_all_or_age_gt(10).proxy_options.should == {:conditions => "(users.age > 10) OR (users.id <= 10)"}
26
+ end
27
+
28
+ it "should work well with _or_equal_to_all" do
29
+ User.id_less_than_or_equal_to_any_or_age_gt(10).proxy_options.should == {:conditions => "(users.age > 10) OR (users.id <= 10)"}
30
+ end
31
+
32
+ it "should play nice with other scopes" do
33
+ User.username_begins_with("ben").id_gt(10).age_not_nil.username_or_name_ends_with("ben").scope(:find).should ==
34
+ {:conditions => "((users.name LIKE '%ben') OR (users.username LIKE '%ben')) AND ((users.age IS NOT NULL) AND ((users.id > 10) AND (users.username LIKE 'ben%')))"}
35
+ end
36
+ end
@@ -20,6 +20,13 @@ describe "Ordering" do
20
20
  it "should have order" do
21
21
  User.order("ascend_by_username").proxy_options.should == User.ascend_by_username.proxy_options
22
22
  end
23
+
24
+ it "should have order by custom scope" do
25
+ User.column_names.should_not include("custom")
26
+ %w(bjohnson thunt fisons).each { |username| User.create(:username => username) }
27
+ User.named_scope(:ascend_by_custom, :order => "username ASC, name DESC")
28
+ User.order("ascend_by_custom").proxy_options.should == User.ascend_by_custom.proxy_options
29
+ end
23
30
 
24
31
  it "should have priorty to columns over conflicting association columns" do
25
32
  Company.ascend_by_users_count
data/spec/search_spec.rb CHANGED
@@ -14,7 +14,9 @@ describe "Search" do
14
14
  company = Company.create
15
15
  user = company.users.create
16
16
  search = company.users.search
17
- search.current_scope.should == company.users.scope(:find)
17
+ expected_options = company.users.scope(:find).dup
18
+ expected_options.delete(:order)
19
+ search.current_scope.should == expected_options
18
20
  end
19
21
  end
20
22
 
@@ -109,6 +111,20 @@ describe "Search" do
109
111
  search.orders_total_gt.should == 10
110
112
  end
111
113
 
114
+ it "should allow setting pre-existing association conditions" do
115
+ User.named_scope :uname, lambda { |value| {:conditions => ["users.username = ?", value]} }
116
+ search = Company.search
117
+ search.users_uname = "bjohnson"
118
+ search.users_uname.should == "bjohnson"
119
+ end
120
+
121
+ it "should allow setting pre-existing association alias conditions" do
122
+ User.alias_scope :username_has, lambda { |value| User.username_like(value) }
123
+ search = Company.search
124
+ search.users_username_has = "bjohnson"
125
+ search.users_username_has.should == "bjohnson"
126
+ end
127
+
112
128
  it "should allow using custom conditions" do
113
129
  User.named_scope(:four_year_olds, { :conditions => { :age => 4 } })
114
130
  search = User.search
@@ -146,6 +162,11 @@ describe "Search" do
146
162
  lambda { search.unknown = true }.should raise_error(Searchlogic::Search::UnknownConditionError)
147
163
  end
148
164
 
165
+ it "should not allow setting conditions on sensitive methods" do
166
+ search = User.search
167
+ lambda { search.destroy = true }.should raise_error(Searchlogic::Search::UnknownConditionError)
168
+ end
169
+
149
170
  it "should not use the ruby implementation of the id method" do
150
171
  search = User.search
151
172
  search.id.should be_nil
@@ -301,6 +322,19 @@ describe "Search" do
301
322
  it "should recognize the order condition" do
302
323
  User.search(:order => "ascend_by_username").proxy_options.should == User.ascend_by_username.proxy_options
303
324
  end
325
+
326
+ it "should not use default scope ordering when one explicitly provided" do
327
+ # default_scope is :order => "created_at asc"
328
+ fee1 = Fee.create(:cost => 2.0)
329
+ fee2 = Fee.create(:cost => 1.0)
330
+
331
+ Fee.search(:order => "ascend_by_cost").proxy_options.should == {:order => "fees.cost ASC"}
332
+ end
333
+
334
+ it "should use default scope ordering when no ordering conditions provided" do
335
+ # default_scope is :order => "created_at asc"
336
+ Fee.search.proxy_options.should == {:order => "created_at ASC"}
337
+ end
304
338
  end
305
339
  end
306
340
 
data/spec/spec_helper.rb CHANGED
@@ -14,9 +14,10 @@ ActiveRecord::Schema.define(:version => 1) do
14
14
  create_table :companies do |t|
15
15
  t.datetime :created_at
16
16
  t.datetime :updated_at
17
+ t.string :name
17
18
  t.integer :users_count, :default => 0
18
19
  end
19
-
20
+
20
21
  create_table :users do |t|
21
22
  t.datetime :created_at
22
23
  t.datetime :updated_at
@@ -25,7 +26,13 @@ ActiveRecord::Schema.define(:version => 1) do
25
26
  t.string :name
26
27
  t.integer :age
27
28
  end
28
-
29
+
30
+ create_table :carts do |t|
31
+ t.datetime :created_at
32
+ t.datetime :updated_at
33
+ t.integer :user_id
34
+ end
35
+
29
36
  create_table :orders do |t|
30
37
  t.datetime :created_at
31
38
  t.datetime :updated_at
@@ -34,7 +41,15 @@ ActiveRecord::Schema.define(:version => 1) do
34
41
  t.float :taxes
35
42
  t.float :total
36
43
  end
37
-
44
+
45
+ create_table :fees do |t|
46
+ t.datetime :created_at
47
+ t.datetime :updated_at
48
+ t.string :owner_type
49
+ t.integer :owner_id
50
+ t.float :cost
51
+ end
52
+
38
53
  create_table :line_items do |t|
39
54
  t.datetime :created_at
40
55
  t.datetime :updated_at
@@ -52,28 +67,34 @@ Spec::Runner.configure do |config|
52
67
  class Company < ActiveRecord::Base
53
68
  has_many :users, :dependent => :destroy
54
69
  end
55
-
70
+
56
71
  class User < ActiveRecord::Base
57
72
  belongs_to :company, :counter_cache => true
58
73
  has_many :orders, :dependent => :destroy
59
- alias_scope :username_has, lambda { |value| username_like(value) }
74
+ has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100'
60
75
  end
61
-
76
+
62
77
  class Order < ActiveRecord::Base
63
78
  belongs_to :user
64
79
  has_many :line_items, :dependent => :destroy
65
80
  end
66
-
81
+
82
+ class Fee < ActiveRecord::Base
83
+ belongs_to :owner, :polymorphic => true
84
+
85
+ default_scope :order => "created_at ASC"
86
+ end
87
+
67
88
  class LineItem < ActiveRecord::Base
68
89
  belongs_to :order
69
90
  end
70
-
91
+
71
92
  Company.destroy_all
72
93
  User.destroy_all
73
94
  Order.destroy_all
74
95
  LineItem.destroy_all
75
96
  end
76
-
97
+
77
98
  config.after(:each) do
78
99
  Object.send(:remove_const, :Company)
79
100
  Object.send(:remove_const, :User)
@@ -81,3 +102,4 @@ Spec::Runner.configure do |config|
81
102
  Object.send(:remove_const, :LineItem)
82
103
  end
83
104
  end
105
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kazjote-searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9.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-07-16 00:00:00 -07:00
12
+ date: 2009-09-02 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.0.0
24
24
  version:
25
- description: Searchlogic provides common named scopes and object based searching for ActiveRecord.
25
+ description: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
26
26
  email: bjohnson@binarylogic.com
27
27
  executables: []
28
28
 
@@ -40,13 +40,15 @@ files:
40
40
  - VERSION.yml
41
41
  - init.rb
42
42
  - lib/searchlogic.rb
43
- - lib/searchlogic/active_record_consistency.rb
43
+ - lib/searchlogic/active_record/consistency.rb
44
+ - lib/searchlogic/active_record/named_scopes.rb
44
45
  - lib/searchlogic/core_ext/object.rb
45
46
  - lib/searchlogic/core_ext/proc.rb
46
47
  - lib/searchlogic/named_scopes/alias_scope.rb
47
48
  - lib/searchlogic/named_scopes/association_conditions.rb
48
49
  - lib/searchlogic/named_scopes/association_ordering.rb
49
50
  - lib/searchlogic/named_scopes/conditions.rb
51
+ - lib/searchlogic/named_scopes/or_conditions.rb
50
52
  - lib/searchlogic/named_scopes/ordering.rb
51
53
  - lib/searchlogic/rails_helpers.rb
52
54
  - lib/searchlogic/search.rb
@@ -58,12 +60,12 @@ files:
58
60
  - spec/named_scopes/association_conditions_spec.rb
59
61
  - spec/named_scopes/association_ordering_spec.rb
60
62
  - spec/named_scopes/conditions_spec.rb
63
+ - spec/named_scopes/or_conditions_spec.rb
61
64
  - spec/named_scopes/ordering_spec.rb
62
65
  - spec/search_spec.rb
63
66
  - spec/spec_helper.rb
64
67
  has_rdoc: false
65
68
  homepage: http://github.com/binarylogic/searchlogic
66
- licenses:
67
69
  post_install_message:
68
70
  rdoc_options:
69
71
  - --charset=UTF-8
@@ -84,10 +86,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
86
  requirements: []
85
87
 
86
88
  rubyforge_project: searchlogic
87
- rubygems_version: 1.3.5
89
+ rubygems_version: 1.2.0
88
90
  signing_key:
89
91
  specification_version: 3
90
- summary: Searchlogic provides common named scopes and object based searching for ActiveRecord.
92
+ summary: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
91
93
  test_files:
92
94
  - spec/core_ext/object_spec.rb
93
95
  - spec/core_ext/proc_spec.rb
@@ -95,6 +97,7 @@ test_files:
95
97
  - spec/named_scopes/association_conditions_spec.rb
96
98
  - spec/named_scopes/association_ordering_spec.rb
97
99
  - spec/named_scopes/conditions_spec.rb
100
+ - spec/named_scopes/or_conditions_spec.rb
98
101
  - spec/named_scopes/ordering_spec.rb
99
102
  - spec/search_spec.rb
100
103
  - spec/spec_helper.rb
@@ -1,27 +0,0 @@
1
- module Searchlogic
2
- # Active Record is pretty inconsistent with how their SQL is constructed. This
3
- # method attempts to close the gap between the various inconsistencies.
4
- module ActiveRecordConsistency
5
- def self.included(klass)
6
- klass.class_eval do
7
- alias_method_chain :merge_joins, :searchlogic
8
- end
9
- end
10
-
11
- # In AR multiple joins are sometimes in a single join query, and other time they
12
- # are not. The merge_joins method in AR should account for this, but it doesn't.
13
- # This fixes that problem.
14
- def merge_joins_with_searchlogic(*args)
15
- joins = merge_joins_without_searchlogic(*args)
16
- joins.collect { |j| j.is_a?(String) ? j.split(" ") : j }.flatten.uniq
17
- end
18
- end
19
- end
20
-
21
- module ActiveRecord # :nodoc: all
22
- class Base
23
- class << self
24
- include Searchlogic::ActiveRecordConsistency
25
- end
26
- end
27
- end