From: Tom Hughes Date: Thu, 27 Jun 2013 17:09:28 +0000 (+0100) Subject: Monkey patch PostgreSQLAdapter to make enums work X-Git-Tag: live~5572 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/36c220ca2bcfb3947e68cea7356e9d5c04a85091 Monkey patch PostgreSQLAdapter to make enums work --- 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