Fixed that association#count would produce invalid sql when called sequentialy #659 [kanis@comcard.de]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@813 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-02-28 09:07:03 +00:00
parent cbe21fb498
commit 6650da43c8
2 changed files with 5 additions and 3 deletions

@ -24,8 +24,8 @@ def find_all(runtime_conditions = nil, orderings = nil, limit = nil, joins = nil
if @options[:finder_sql]
records = @association_class.find_by_sql(@finder_sql)
else
sql = @finder_sql.dup
sql << " AND #{sanitize_sql(runtime_conditions)}" if runtime_conditions
sql = @finder_sql
sql += " AND #{sanitize_sql(runtime_conditions)}" if runtime_conditions
orderings ||= @options[:order]
records = @association_class.find_all(sql, orderings, limit, joins)
end
@ -37,7 +37,7 @@ def count(runtime_conditions = nil)
@association_class.count_by_sql(@finder_sql)
else
sql = @finder_sql
sql << " AND #{sanitize_sql(runtime_conditions)}" if runtime_conditions
sql += " AND #{sanitize_sql(runtime_conditions)}" if runtime_conditions
@association_class.count(sql)
end
end

@ -1,5 +1,7 @@
*SVN*
* Fixed that association#count would produce invalid sql when called sequentialy #659 [kanis@comcard.de]
* Fixed test/mocks/testing to the correct test/mocks/test #740
* Added early failure if the Ruby version isn't 1.8.2 or above #735