Ticket #10605: without_sql_variable.diff
| File without_sql_variable.diff, 0.9 kB (added by jamesh, 7 months ago) |
|---|
-
activerecord/lib/active_record/base.rb
old new 548 548 # Person.exists?(:name => "David") 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 555 561 # Creates an object (or multiple objects) and saves it to the database, if validations pass.