Avoid "unknown OID" warnings from Postgres driver
authorTom Hughes <tom@compton.nu>
Mon, 23 Sep 2013 10:41:35 +0000 (11:41 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 23 Sep 2013 10:41:35 +0000 (11:41 +0100)
config/initializers/postgresql_adapter.rb

index 825feba8bd3b0cbe885bd397dc23a1f7bdefc6be..ff1f7f87ad5ee1ea3d8c9491eb063a34915dfb84 100644 (file)
@@ -58,6 +58,20 @@ if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
         rescue
           nil
         end
+
+        def initialize_type_map_with_enums
+          OID.alias_type "format_enum", "text"
+          OID.alias_type "gpx_visibility_enum", "text"
+          OID.alias_type "note_status_enum", "text"
+          OID.alias_type "note_event_enum", "text"
+          OID.alias_type "nwr_enum", "text"
+          OID.alias_type "user_role_enum", "text"
+          OID.alias_type "user_status_enum", "text"
+
+          initialize_type_map_without_enums
+        end
+
+        alias_method_chain :initialize_type_map, :enums
       end
 
       class PostgreSQLColumn