aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/calculations.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-15 13:01:13 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-15 13:01:13 -0200
commitda5e5c5f779355a2e99e63a90612cbeaeb0fc986 (patch)
tree216e24f855e84473808766d7a58d20c953b6a2d8 /activerecord/lib/active_record/relation/calculations.rb
parent823604ec1659109eedeb2db91de325d413c73452 (diff)
downloadrails-da5e5c5f779355a2e99e63a90612cbeaeb0fc986.tar.gz
rails-da5e5c5f779355a2e99e63a90612cbeaeb0fc986.tar.bz2
rails-da5e5c5f779355a2e99e63a90612cbeaeb0fc986.zip
Revert "Merge pull request #7983 from georgebrock/bug7950-squashed"
This reverts commit 88a296dccc401da143d90cad54b693ff06bf2b58, reversing changes made to 666a7e34f553cef4c8878362eafc79c7e3f310c3. Conflicts: activerecord/CHANGELOG.md Reason: this has been resulting in some hard to track bugs and is introducing a possible breackage in a stable version.
Diffstat (limited to 'activerecord/lib/active_record/relation/calculations.rb')
-rw-r--r--activerecord/lib/active_record/relation/calculations.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb
index 20c5fa03a2..ceacf93b60 100644
--- a/activerecord/lib/active_record/relation/calculations.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -185,7 +185,7 @@ module ActiveRecord
relation = clone
relation.select_values = [column_name]
- klass.connection.select_all(relation.arel, nil, bind_values).map! do |attributes|
+ klass.connection.select_all(relation.arel).map! do |attributes|
klass.type_cast_attribute(attributes.keys.first, klass.initialize_attributes(attributes))
end
end
@@ -247,8 +247,7 @@ module ActiveRecord
query_builder = relation.arel
end
- result = @klass.connection.select_value(query_builder, nil, relation.bind_values)
- type_cast_calculated_value(result, column_for(column_name), operation)
+ type_cast_calculated_value(@klass.connection.select_value(query_builder), column_for(column_name), operation)
end
def execute_grouped_calculation(operation, column_name, distinct) #:nodoc:
@@ -294,7 +293,7 @@ module ActiveRecord
relation = except(:group).group(group)
relation.select_values = select_values
- calculated_data = @klass.connection.select_all(relation, nil, bind_values)
+ calculated_data = @klass.connection.select_all(relation)
if association
key_ids = calculated_data.collect { |row| row[group_aliases.first] }