<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -37,4 +37,4 @@ end
 if defined?(ActionController)
   require &quot;searchlogic/rails_helpers&quot;
   ActionController::Base.helper(Searchlogic::RailsHelpers)
-end
\ No newline at end of file
+end</diff>
      <filename>lib/searchlogic.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,10 +13,15 @@ module Searchlogic
       # ActiveRecord hides this internally in a Proc, so we have to try and pull it out with this
       # method.
       def named_scope_options(name)
+
         key = scopes.key?(name.to_sym) ? name.to_sym : primary_condition_name(name)
         
         if key
           eval(&quot;options&quot;, scopes[key].binding)
+        elsif name.to_s.downcase.match(&quot;_or_&quot;)
+          condition = find_applied_condition(name)
+          newname = name.to_s.gsub(/_or_/, &quot;_#{condition}_or_&quot;).to_sym
+          named_scope_options(newname) unless name == newname
         else
           nil
         end</diff>
      <filename>lib/searchlogic/active_record/named_scopes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -64,4 +64,4 @@ module Searchlogic
       end
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/searchlogic/named_scopes/alias_scope.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ module Searchlogic
       
       private
         def association_condition?(name)
-          !association_condition_details(name).nil?
+          !association_condition_details(name).nil? unless name.to_s.downcase.match(&quot;_or_&quot;)
         end
         
         def method_missing(name, *args, &amp;block)
@@ -24,20 +24,18 @@ module Searchlogic
           assocs = reflect_on_all_associations.reject { |assoc| assoc.options[:polymorphic] }.sort { |a, b| b.name.to_s.size &lt;=&gt; a.name.to_s.size }
           return nil if assocs.empty?
           
-          [nil, last_condition].uniq.map do |condition|
-            name_with_condition = [name, condition].compact.join('_')
-            if name_with_condition.to_s =~ /^(#{assocs.collect(&amp;:name).join(&quot;|&quot;)})_(\w+)$/
-              association_name = $1
-              condition = $2
-              association = reflect_on_association(association_name.to_sym)
-              klass = association.klass
-              if klass.condition?(condition)
-                {:association =&gt; $1, :condition =&gt; $2}
-              else
-                nil
-              end
+          name_with_condition = [name, last_condition].compact.join('_')
+          if name_with_condition.to_s =~ /^(#{assocs.collect(&amp;:name).join(&quot;|&quot;)})_(\w+)$/
+            association_name = $1
+            condition = $2
+            association = reflect_on_association(association_name.to_sym)
+            klass = association.klass
+            if klass.condition?(condition)
+              {:association =&gt; $1, :condition =&gt; $2}
+            else
+              nil
             end
-          end.detect{ |details| !details.nil? }
+          end
         end
         
         def create_association_condition(association, condition, args)
@@ -101,4 +99,4 @@ module Searchlogic
         end
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/searchlogic/named_scopes/association_conditions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,4 +40,4 @@ module Searchlogic
         end
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/searchlogic/named_scopes/association_ordering.rb</filename>
    </modified>
    <modified>
      <diff>@@ -76,6 +76,12 @@ module Searchlogic
             super
           end
         end
+
+        def find_applied_condition(name)
+          if name.to_s =~ /(#{(PRIMARY_CONDITIONS + ALIAS_CONDITIONS).join(&quot;|&quot;)})$/
+            $1
+          end
+        end
         
         def condition_details(name, *args)
           if args.size &gt; 0 and !args.first.nil?</diff>
      <filename>lib/searchlogic/named_scopes/conditions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -45,4 +45,4 @@ module Searchlogic
         end
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/searchlogic/named_scopes/ordering.rb</filename>
    </modified>
    <modified>
      <diff>@@ -104,7 +104,7 @@ describe &quot;Search&quot; do
       search.username_gt.should == &quot;bjohnson&quot;
     end
     
-    it &quot;should allow chainging conditions&quot; do
+    it &quot;should allow chaining conditions&quot; do
       user = User.create(:username =&gt; &quot;bjohnson&quot;, :age =&gt; 20)
       User.create(:username =&gt; &quot;bjohnson&quot;, :age =&gt; 5)
       search = User.search
@@ -112,6 +112,12 @@ describe &quot;Search&quot; do
       search.all.should == [user]
     end
     
+    it &quot;should allow chaining conditions with n-depth associations&quot; do
+      search = User.search
+      search.company_conglomerate_name_or_company_conglomerate_description_like(&quot;ben&quot;)
+      search.proxy_options.should == User.company_conglomerate_name_or_company_conglomerate_description_like(&quot;ben&quot;).proxy_options
+    end
+
     it &quot;should allow setting association conditions&quot; do
       search = User.search
       search.orders_total_gt = 10</diff>
      <filename>spec/search_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6915df9fa199a28d0753b354d6fa4f619454a137</id>
    </parent>
  </parents>
  <author>
    <name>n00bish</name>
    <email>skolod@lueshi.dontexist.net</email>
  </author>
  <url>http://github.com/binarylogic/searchlogic/commit/b2ebf53c8310bc41cb5b3fbef17946423bad8c71</url>
  <id>b2ebf53c8310bc41cb5b3fbef17946423bad8c71</id>
  <committed-date>2009-10-24T20:18:55-07:00</committed-date>
  <authored-date>2009-10-24T18:00:30-07:00</authored-date>
  <message>Fixed association condition interpreter from erroneously catching &quot;OR&quot; conditions &amp; added failing case &quot;chaining conditions with n-depth associations&quot;, with resolution for issue.</message>
  <tree>d62fcfd03a052f7175745b4a96e75d07c6a576d0</tree>
  <committer>
    <name>Ben Johnson</name>
    <email>bjohnson@binarylogic.com</email>
  </committer>
</commit>
