diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-28 09:07:03 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-28 09:07:03 +0000 |
commit | 6650da43c86593423741c3a411348464c7b000f2 (patch) | |
tree | d09f59cb69d8b7e2bb37e06650c925a357990432 /activerecord/lib | |
parent | cbe21fb498b7dc5345c859ad66c102682934de71 (diff) | |
download | rails-6650da43c86593423741c3a411348464c7b000f2.tar.gz rails-6650da43c86593423741c3a411348464c7b000f2.tar.bz2 rails-6650da43c86593423741c3a411348464c7b000f2.zip |
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 0d72b9b0c5..9aed6af48b 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -24,8 +24,8 @@ module ActiveRecord 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 @@ module ActiveRecord @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 |