Skip to content

String keys in database #52

Description

@kalsan

Hi! Your approach looks very promising. There is one feature that might be interesting, but I wasn't able to find it in the README and a glimpse into the code did not reveal it either: does ActiveEnum support String keys (including a String column in the DB)?

Background: https://api.rubyonrails.org/v7.0/classes/ActiveRecord/Enum.html

Finally it's also possible to use a string column to persist the enumerated value. Note that this will likely lead to slower database queries:

class Conversation < ActiveRecord::Base
  enum :status, active: "active", archived: "archived"
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions