Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: binarylogic/searchlogic
base: master
...
head fork: twalpole/searchlogic
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
1  lib/searchlogic/named_scopes/association_conditions.rb
@@ -30,7 +30,6 @@ def association_condition_details(name, last_condition = nil)
association_name = nil
poly_type = nil
condition = nil
-
if name_with_condition.to_s =~ /^(#{non_poly_assocs.collect(&:name).join("|")})_(\w+)$/
association_name = $1
condition = $2
View
4 lib/searchlogic/named_scopes/or_conditions.rb
@@ -81,6 +81,10 @@ def interpolate_or_conditions(parts)
path = full_association_path(part, last_condition, association_details[:association])
conditions << "#{path[:path].join("_").to_sym}_#{path[:column]}_#{path[:condition]}"
last_condition = path[:condition] || nil
+ elsif association_details = association_condition_details(part, nil)
+ path = full_association_path(part, nil, association_details[:association])
+ conditions << "#{path[:path].join("_").to_sym}_#{path[:column]}_#{path[:condition]}"
+ last_condition = path[:condition] || nil
elsif local_condition?(part)
# We are a custom scope
conditions << part
View
1  spec/named_scopes/or_conditions_spec.rb
@@ -44,6 +44,7 @@
User.name_or_company_name_like("ben").proxy_options.should == {:joins => :company, :conditions => "(users.name LIKE '%ben%') OR (companies.name LIKE '%ben%')"}
User.company_name_or_name_like("ben").proxy_options.should == {:joins => :company, :conditions => "(companies.name LIKE '%ben%') OR (users.name LIKE '%ben%')"}
User.company_name_or_company_description_like("ben").proxy_options.should == {:joins =>[:company], :conditions => "(companies.name LIKE '%ben%') OR (companies.description LIKE '%ben%')"}
+ User.company_name_is_or_company_description_like("ben").proxy_options.should == {:joins =>[:company], :conditions => "(companies.name = 'ben') OR (companies.description LIKE '%ben%')"}
end
it "should not get confused by the 'or' in find_or_create_by_* methods" do

No commit comments for this range

Something went wrong with that request. Please try again.