From 36c220ca2bcfb3947e68cea7356e9d5c04a85091 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 27 Jun 2013 18:09:28 +0100 Subject: [PATCH] Monkey patch PostgreSQLAdapter to make enums work --- config/initializers/postgresql_adapter.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/initializers/postgresql_adapter.rb b/config/initializers/postgresql_adapter.rb index 75971e4bf..825feba8b 100644 --- a/config/initializers/postgresql_adapter.rb +++ b/config/initializers/postgresql_adapter.rb @@ -59,6 +59,19 @@ if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) nil end end + + class PostgreSQLColumn + def simplified_type_with_enum(field_type) + case field_type + when /_enum$/ + :string + else + simplified_type_without_enum(field_type) + end + end + + alias_method_chain :simplified_type, :enum + end end end end -- 2.39.5