Open jgaskins opened 10 years ago
I've been rolling everything in this gem, but that's probably a good idea. :-) I've been wondering if some of this stuff could be punted to gems because I know I've made some dumb decisions in some places.
If Coercible is a good use case for this, I'd like to use it for all of the type casts. I'll check it out.
AFAIK Coercible is ready to go, and its being developed by Solnic and the other ROM guys, so I thought it might be good to spike out if it'll work well for your use cases.
Are you doing all of your object mappings in serializer or am I looking in the wrong place?
The Postgres::Table::Attribute
class is where things get mapped between Ruby and PostgreSQL types. You'll notice it's a big if
chain. I want to remove that VARCHAR
because there is no reason to use it in Postgres, which will let us remove all actual logic from that and just use a Hash lookup or something.
Oh, I just realized, that only shows the mappings from Ruby to Postgres types. The reverse mappings are in Serializer#unserialize_attribute
. It's ugly and I want to refactor it out into a single place.
Oh yeah I was looking in the completely wrong place.
Would it be useful to use Coercible to help with this?