Skip to content
#

enum

Here are 417 public repositories matching this topic...

gaffneyc
gaffneyc commented Mar 5, 2019

When trying to use ActiveRecord's Enum stuff with an enum column I end up with a type mismatch when creating records. ActiveRecord defaults to converting the enum values to integers which does not map correctly to PostgreSQL's enum types. The workaround is to specify each value as the string version of the enum.

Model

class AddOn < ActiveRecord::Base
  enum category: %i[thermos

Improve this page

Add a description, image, and links to the enum topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the enum topic, visit your repo's landing page and select "manage topics."

Learn more

You can’t perform that action at this time.