Changeset 1058
- Timestamp:
- 04/02/05 08:29:54 (4 years 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
r1047 r1058 1 1 *SVN* 2 2 3 * Added a join parameter as the third argument to Base.find_first #426[skaes@web.de]3 * Added a join parameter as the third argument to Base.find_first and as the second to Base.count #426, #988 [skaes@web.de] 4 4 5 5 * Fixed bug in Base#hash method that would treat records with the same string-based id as different [Dave Thomas] trunk/activerecord/lib/active_record/base.rb
r1047 r1058 453 453 # Returns the number of records that meets the +conditions+. Zero is returned if no records match. Example: 454 454 # Product.count "sales > 1" 455 def count(conditions = nil) 456 sql = "SELECT COUNT(*) FROM #{table_name} " 455 def count(conditions = nil, joins = nil) 456 tbl_var_name = joins ? table_name[0,1].downcase : "" 457 sql = "SELECT COUNT(*) FROM #{table_name} #{tbl_var_name} " 458 sql << ", #{joins} " if joins 457 459 add_conditions!(sql, conditions) 458 460 count_by_sql(sql)