From 3070b043bb32400b29135716f1c4ffcf40febad6 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 31 Jan 2009 21:35:31 -0500 Subject: [PATCH] Update the exists? documentation --- activerecord/lib/active_record/base.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 6ad1304..9f9fbd8 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -663,7 +663,7 @@ module ActiveRecord #:nodoc: # Returns true if a record exists in the table that matches the +id+ or - # conditions given, or false otherwise. The argument can take four forms: + # conditions given, or false otherwise. The argument can take five forms: # # * Integer - Finds the record with this primary key. # * String - Finds the record with a primary key corresponding to this @@ -672,6 +672,7 @@ module ActiveRecord #:nodoc: # (such as ['color = ?', 'red']). # * Hash - Finds the record that matches these +find+-style conditions # (such as {:color => 'red'}). + # * No args - Returns false if the table is empty, true otherwise. # # For more information about specifying conditions as a Hash or Array, # see the Conditions section in the introduction to ActiveRecord::Base. @@ -685,6 +686,7 @@ module ActiveRecord #:nodoc: # Person.exists?('5') # Person.exists?(:name => "David") # Person.exists?(['name LIKE ?', "%#{query}%"]) + # Person.exists? def exists?(id_or_conditions = {}) connection.select_all( construct_finder_sql( -- 1.6.0.4