Changeset 8531
- Timestamp:
- 01/02/08 21:39:49 (4 months ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/base.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r8524 r8531 1 1 *SVN* 2 3 * Optimize ActiveRecord::Base#exists? to use #select_all instead of #find. Closes #10605 [jamesh, fcheung, protocool] 2 4 3 5 * Don't unnecessarily load has_many associations in after_update callbacks. Closes #6822 [stopdropandrew, canadaduane] trunk/activerecord/lib/active_record/base.rb
r8496 r8531 549 549 # Person.exists?(['name LIKE ?', "%#{query}%"]) 550 550 def exists?(id_or_conditions) 551 !find(:first, :select => "#{quoted_table_name}.#{primary_key}", 552 :conditions => expand_id_conditions(id_or_conditions)).nil? 551 connection.select_all( 552 construct_finder_sql( 553 :select => "#{quoted_table_name}.#{primary_key}", 554 :conditions => expand_id_conditions(id_or_conditions), 555 :limit => 1 556 ), 557 "#{name} Exists" 558 ).size > 0 553 559 end 554 560