ActiveRecord Parity: Add "enum" type (similar to ActiveRecord::Enum)

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Attributes
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Rails 4.1 introduced ActiveRecord::Enum. This article gives a good overview of Rails' functionality and helper functions.

      Nearly all apps will have some use case for enums. In Mongoid they are typically strings or symbols. It would be great if Mongoid could support something like the following:

       

      field :status, type: :enum, values: [:started, :pending, :done]
      

       

      I believe there is a mongoid_enum gem, however, since its in AR core, I think there is a good argument to make it core in mongoid as well. Possibly could be done after some of the type refactoring.

              Assignee:
              Unassigned
              Reporter:
              Johnny Shields
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: