To edit pages or tickets please login with username/password: aaf/aaf

Changeset 332

Show
Ignore:
Timestamp:
02/29/08 19:20:34 (7 months ago)
Author:
jk
Message:

Applied scope support patch by Tom Locke. Thanks!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugin/acts_as_ferret/lib/class_methods.rb

    r323 r332  
    147147    # +conitions+ present in +find_options+. 
    148148    def find_with_ferret(q, options = {}, find_options = {}) 
     149      if scope(:find, :conditions) 
     150        if find_options[:conditions] 
     151          find_options[:conditions] = "(#{find_options[:conditions]}) AND (#{scope(:find, :conditions)})" 
     152        else 
     153          find_options[:conditions] = scope(:find, :conditions) 
     154        end 
     155      end 
     156 
    149157      if options[:per_page] 
    150158        options[:page] = options[:page] ? options[:page].to_i : 1 
  • trunk/plugin/acts_as_ferret/lib/ferret_find_methods.rb

    r327 r332  
    3030      # count total_hits via sql when using conditions, multiple models, or when we're called 
    3131      # from an ActiveRecord association. 
    32       if id_arrays.size > 1 or ar_options[:conditions] or caller.find{ |call| call =~ %r{active_record/associations} } 
     32      if id_arrays.size > 1 or ar_options[:conditions] 
    3333        # chances are the ferret result count is not our total_hits value, so 
    3434        # we correct this here. 

To edit pages or tickets please login with username/password: aaf/aaf