Permalink
Browse files

Merge pull request #10557 from arunagw/pluck-refactor-using-map

Using map. No need to run query again
  • Loading branch information...
2 parents 4fa8607 + afedb09 commit a71119335e312acde8d346ffc8fe109b1a99f4bd @pixeltrix pixeltrix committed May 10, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/calculations.rb
@@ -184,7 +184,7 @@ def pluck(column_name)
result = klass.connection.exec_query(select(column_name).to_sql)
last_column = result.columns.last
- klass.connection.select_all(select(column_name).arel).map! do |attributes|
+ result.map do |attributes|
klass.type_cast_attribute(last_column, klass.initialize_attributes(attributes))
end
end

0 comments on commit a711193

Please sign in to comment.