Skip to content

Commit

Permalink
Allowed the interpolate_or_conditions method to properly parse associ…
Browse files Browse the repository at this point in the history
…ation scopes and remove the :readonly find scope option.
  • Loading branch information
laserlemon authored and binarylogic committed Oct 20, 2009
1 parent cdb8b88 commit e724d6d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/searchlogic/named_scopes/or_conditions.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e724d6d

Please sign in to comment.