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

Changeset 302

Show
Ignore:
Timestamp:
02/01/08 19:17:14 (8 months ago)
Author:
jk
Message:

rebuild index rake task, capistrano 2 recipes

Files:

Legend:

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

    r298 r302  
    5454        logger.info "using mysql specific batched find :all. Turn off with  :mysql_fast_batches => false if you encounter problems (i.e. because of non-integer UUIDs in the id column)" 
    5555        true 
     56      end 
     57    end 
     58 
     59    # Returns all records modified or created after the specified time. 
     60    # Used by the rake rebuild task to find models that need to be updated in 
     61    # the index after the rebuild finished because they changed while the 
     62    # rebuild was running. 
     63    # Override if your models don't stick to the created_at/updated_at 
     64    # convention. 
     65    def records_modified_since(time) 
     66      condition = [] 
     67      %w(updated_at created_at).each do |col| 
     68        condition << "#{col} >= ?" if column_names.include? col 
     69      end 
     70      if condition.empty? 
     71        logger.warn "#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild." 
     72        [] 
     73      else 
     74        find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ] 
    5675      end 
    5776    end 

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