Permalink
Browse files

Allowed the interpolate_or_conditions method to properly parse associ…

…ation scopes and remove the :readonly find scope option.
  • Loading branch information...
1 parent cdb8b88 commit e724d6d59ad96565069c35921b01fdd3bfd89038 @laserlemon laserlemon committed with Oct 1, 2009
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/searchlogic/named_scopes/or_conditions.rb
@@ -73,8 +73,11 @@ def interpolate_or_conditions(parts)
# We are a searchlogic defined scope
conditions << "#{details[:column]}_#{details[:condition]}"
last_condition = details[:condition]
- elsif details = association_condition_details(part)
- # pending, need to find the last condition
+ elsif association_details = association_condition_details(part)
+ if details = condition_details(association_details[:condition])
+ conditions << "#{association_details[:association]}_#{details[:column]}_#{details[:condition]}"
+ last_condition = details[:condition]
+ end
elsif local_condition?(part)
# We are a custom scope
conditions << part
@@ -109,7 +112,9 @@ def merge_scopes_with_or(scopes)
scope.send(scope_name, *args)
end
- scope.scope(:find).merge(:conditions => "(" + conditions.join(") OR (") + ")")
+ options = scope.scope(:find)
+ options.delete(:readonly) unless scope.proxy_options.key?(:readonly)
+ options.merge(:conditions => "(" + conditions.join(") OR (") + ")")
end
end
end

0 comments on commit e724d6d

Please sign in to comment.