searchlogic 2.5.4 → 2.5.5
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
@@ -33,7 +33,7 @@ module Searchlogic
|
|
33
33
|
# is a safe method.
|
34
34
|
def alias_scope(name, options = nil)
|
35
35
|
alias_scopes[name.to_sym] = options
|
36
|
-
(class << self; self end).instance_eval do
|
36
|
+
(class << self; self; end).instance_eval do
|
37
37
|
define_method name do |*args|
|
38
38
|
case options
|
39
39
|
when Symbol
|
@@ -101,20 +101,20 @@ module Searchlogic
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def full_association_path(part, last_condition, given_assoc)
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
104
|
+
path = [given_assoc.name]
|
105
|
+
part.sub!(/^#{given_assoc.name}_/, "")
|
106
|
+
klass = self
|
107
|
+
while klass = klass.send(:reflect_on_association, given_assoc.name)
|
108
|
+
klass = klass.klass
|
109
|
+
if details = klass.send(:association_condition_details, part, last_condition)
|
110
|
+
path << details[:association].name
|
111
|
+
part = details[:condition]
|
112
|
+
given_assoc = details[:association]
|
113
|
+
elsif details = klass.send(:condition_details, part)
|
114
|
+
return { :path => path, :column => details[:column], :condition => details[:condition] }
|
116
115
|
end
|
117
|
-
|
116
|
+
end
|
117
|
+
{:path => path, :column => part, :condition => last_condition}
|
118
118
|
end
|
119
119
|
|
120
120
|
def create_or_condition(scopes)
|
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.5.
|
8
|
+
s.version = "2.5.5"
|
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-
|
12
|
+
s.date = %q{2011-04-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 = [
|
@@ -44,6 +44,7 @@ describe Searchlogic::NamedScopes::OrConditions do
|
|
44
44
|
User.name_or_company_name_like("ben").proxy_options.should == {:joins => :company, :conditions => "(users.name LIKE '%ben%') OR (companies.name LIKE '%ben%')"}
|
45
45
|
User.company_name_or_name_like("ben").proxy_options.should == {:joins => :company, :conditions => "(companies.name LIKE '%ben%') OR (users.name LIKE '%ben%')"}
|
46
46
|
User.company_name_or_company_description_like("ben").proxy_options.should == {:joins =>[:company], :conditions => "(companies.name LIKE '%ben%') OR (companies.description LIKE '%ben%')"}
|
47
|
+
Cart.user_company_name_or_user_company_name_like("ben").proxy_options.should == {:joins => {:user=>:company}, :conditions => "(companies.name LIKE '%ben%') OR (companies.name LIKE '%ben%')"}
|
47
48
|
end
|
48
49
|
|
49
50
|
it "should not get confused by the 'or' in find_or_create_by_* methods" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: searchlogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.5.
|
5
|
+
version: 2.5.5
|
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-
|
13
|
+
date: 2011-04-07 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
104
|
requirements:
|
105
105
|
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
hash:
|
107
|
+
hash: 2802957322570024148
|
108
108
|
segments:
|
109
109
|
- 0
|
110
110
|
version: "0"
|