Rails 4.0 Sneak Peek: Expanded ActiveRecord Support for PostgreSQL Datatypes(reefpoints.dockyard.com) |
Rails 4.0 Sneak Peek: Expanded ActiveRecord Support for PostgreSQL Datatypes(reefpoints.dockyard.com) |
In AR 4.0, you can have ActiveRecord automatically cast them to a different type.
Turns out support for that's in 4.0 too!
https://github.com/rails/rails/pull/4775
Take a look at @tenderlove's comment down below about the actual implementation (as opposed to my crappy one in the issue body).
Schema.rb is inherently a broken concept anyway, because it's lossy. What you really want is the SQL, which is the only format that completely encapsulates your schema in AR. I often wish AR was declarative for that reason.
The default Rails tooling for loading and dumping the structure is also completely harebrained (google it and you will get a gazillion hits), so we wrote our own internal gem that does all of it for us, along with overriding db:test:prepare.