Monkey patch PostgreSQLAdapter to make enums work

This commit is contained in:
Tom Hughes 2013-06-27 18:09:28 +01:00
parent 984c6dc114
commit 36c220ca2b

View file

@ -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