rails/rails — pull request #12666 by cfabianski (2013-10-27 20:22:47+00:00)
Title: Datatypes should be typecasted

**Result should return type_casted values**
The `type_cast` should be done earlier. `select_*` uses the values
provided by the `result` class, so it makes sense to use the `type_cast`
method from the adapters and passed into the class (`column_types`).

*before*

```
Person.create(
tags: ["cfabianski", "cedric"],
tag_ids: [4, 8, 9]
)

query = Person.where(["? = ANY (tags)", "cfabianski"])
row = Person.connection.select_one(query)

=> {"id" => "1", tags" => "{cfabianski,cedric}", "tag_ids" => "{4,8,9}"}
```

*after*

```
Person.create(
tags: ["cfabianski", "cedric"],
tag_ids: [4, 8, 9]
)

query = Person.where(["? = ANY (tags)", "cfabianski"])
row = Person.connection.select_one(query)

=> {"id" => 1, "tags" => [cfabianski, cedric], "tag_ids" => [4, 8, 9]}
```

This would be awesome to have IMO, though, I have some pain with these 2 tests
[1](https://github.com/rails/rails/blob/master/activerecord/test/cases/fixtures_test.rb#L248)
[2](https://github.com/rails/rails/blob/master/activerecord/test/cases/binary_test.rb#L45) that fails only with postgres and because of the `flowers.jpg` file.

If someone has any idea, please let me know :smiley: