Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4141

Show
Ignore:
Timestamp:
04/03/06 16:09:47 (2 years ago)
Author:
rick
Message:

Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations. (closes #4456) [Stefan]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r4129 r4141  
    11*SVN* 
     2 
     3* Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations.  (closes #4456) [Stefan] 
    24 
    35* Private ActiveRecord methods add_limit!, add_joins!, and add_conditions! take an OPTIONAL third argument 'scope' (closes #4456) [Rick] 
  • trunk/activerecord/lib/active_record/base.rb

    r4140 r4141  
    872872        begin 
    873873          yield 
    874         ensure  
     874        ensure 
    875875          self.scoped_methods.pop 
    876876        end 
     
    10381038 
    10391039        # The optional scope argument is for the current :find scope. 
    1040         def add_limit!(sql, options, scope = nil) 
    1041           if scope ||= scope(:find) 
     1040        def add_limit!(sql, options, scope = :auto) 
     1041          scope = scope(:find) if :auto == scope 
     1042          if scope 
    10421043            options[:limit]  ||= scope[:limit] 
    10431044            options[:offset] ||= scope[:offset] 
     
    10471048 
    10481049        # The optional scope argument is for the current :find scope. 
    1049         def add_joins!(sql, options, scope = nil
    1050           scope ||= scope(:find) 
     1050        def add_joins!(sql, options, scope = :auto
     1051          scope = scope(:find) if :auto == scope 
    10511052          join = (scope && scope[:joins]) || options[:joins] 
    10521053          sql << " #{join} " if join 
     
    10551056        # Adds a sanitized version of +conditions+ to the +sql+ string. Note that the passed-in +sql+ string is changed. 
    10561057        # The optional scope argument is for the current :find scope. 
    1057         def add_conditions!(sql, conditions, scope = nil
    1058           scope ||= scope(:find) 
     1058        def add_conditions!(sql, conditions, scope = :auto
     1059          scope = scope(:find) if :auto == scope 
    10591060          segments = [] 
    10601061          segments << sanitize_sql(scope[:conditions]) if scope && scope[:conditions]