rails/rails — pull request #3899 by sikachu (2011-12-08 02:21:27+00:00)
Title: Implements `ActiveRecord::Base.connection.select_pair`

This new method will return a hash which use the first column of your result set as a key, and use the second column as a value. This is useful in an scenario where you want to map your data with an aggregated function.

For example:

```ruby
Company.connection.select_values("SELECT group, COUNT(*) FROM users GROUP BY group")
# => { "admin" => "2", "moderator" => "5", "user" => "3" }
```