forgottentea-xx / pg_assets

Mostly seamless management of functions, triggers, views, and materialized views
MIT License
7 stars 2 forks source link

Fix for unknown oid messages fails in rails 4.2 #2

Open ajh opened 8 years ago

ajh commented 8 years ago

With this error:

/Users/ajh/devel/pg_assets/lib/pg_assets/railtie.rb:23:in `block (2 levels) in <class:Railtie>': undefined method `registered_type?' for ActiveRecord::ConnectionAdapters::PostgreSQL::OID:Module (NoMethodError)
        from /Users/ajh/devel/pg_assets/lib/pg_assets/railtie.rb:22:in `each_pair'
        from /Users/ajh/devel/pg_assets/lib/pg_assets/railtie.rb:22:in `block in <class:Railtie>'
forgottentea-xx commented 8 years ago

Thinking about changing the travis tests to build against multiple rails versions, like thoughtbot does: https://github.com/thoughtbot/paperclip/blob/master/.travis.yml

THEN, I will have the confidence to replace this feature with something that works with multiple versions.

Probably I'll do 4.0, 4.1, 4.2, and 5.0.

forgottentea-xx commented 8 years ago

I have a partial fix for this worked out here: https://github.com/forgottentea/pg_assets/tree/OID-issue

One of the column types is an array. I haven't found out how to map an array oid type yet. I hope its possible.

All the warnings are gone from rails 4.0 and 4.1, and there is just one remaining for 4.2

forgottentea-xx commented 8 years ago

I'm pretty sure this is a weird AR bug. It knows that is an array type, but it won't pick up the type even though I have already mapped it.

<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x007fcb34b9e978 @array=true, @name="proacl", @cast_type=#<ActiveRecord::Type::Value:0x007fcb34b27440 @precision=nil, @scale=nil, @limit=nil>, @sql_type="aclitem", @null=true, @default=nil, @default_function=nil>