I have an array field in one of my models, with elements being symbols. For example, here is how I assign values to this field:
Model.field = [:a, :b, :c]
I use Postgres so I store these arrays in an array column. The problem is that Rails automatically serializes the symbols from the given array to strings when saving them to the database, but doesn't convert them back to symbols when objects are fetched from the database. How can I tell my model to automatically convert array values to symbols?
serialize :field, Serializer, but I guess thatSerializeralready exists for my needs.