Changeset 4141
- Timestamp:
- 04/03/06 16:09:47 (2 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/base.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r4129 r4141 1 1 *SVN* 2 3 * Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations. (closes #4456) [Stefan] 2 4 3 5 * 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 872 872 begin 873 873 yield 874 ensure 874 ensure 875 875 self.scoped_methods.pop 876 876 end … … 1038 1038 1039 1039 # 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 1042 1043 options[:limit] ||= scope[:limit] 1043 1044 options[:offset] ||= scope[:offset] … … 1047 1048 1048 1049 # 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 1051 1052 join = (scope && scope[:joins]) || options[:joins] 1052 1053 sql << " #{join} " if join … … 1055 1056 # Adds a sanitized version of +conditions+ to the +sql+ string. Note that the passed-in +sql+ string is changed. 1056 1057 # 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 1059 1060 segments = [] 1060 1061 segments << sanitize_sql(scope[:conditions]) if scope && scope[:conditions]