Duplication of enum across two models In my Rails app, I have two classes each with the same enum for status. Code climate is complaining about duplication.

class Enrolment &lt; ActiveRecord::Base
  has_many :enrolment_presentations
  has_many :presentations, through: :enrolment_presentations

  enum status: {
    'Pending' =&gt; 1,
    'Suspended' =&gt; 2,
    'Cancelled' =&gt; 3,
    'Pass' =&gt; 4,
    'Fail' =&gt; 5,
    'DPR' =&gt; 6,
    'Unknown' =&gt; 7,
    'Enrolled' =&gt; 8
  }
end


class EnrolmentPresentations &lt; ActiveRecord::Base
  belongs_to :enrolment
  belongs_to :presentation

  enum status: {
    'Pending' =&gt; 1,
    'Suspended' =&gt; 2,
    'Cancelled' =&gt; 3,
    'Pass' =&gt; 4,
    'Fail' =&gt; 5,
    'DPR' =&gt; 6,
    'Unknown' =&gt; 7,
    'Enrolled' =&gt; 8
  }
end


How would you go about removing this duplication?
Forgive my ignorance, but isn't ActiveRecord::Base#enum just a method? Therefore, to help reduce duplication (but not eliminate it), you could do something like this:

STATUS_FLAGS = {
  'Pending' =&gt; 1,
  'Suspended' =&gt; 2,
  'Cancelled' =&gt; 3,
  'Pass' =&gt; 4,
  'Fail' =&gt; 5,
  'DPR' =&gt; 6,
  'Unknown' =&gt; 7,
  'Enrolled' =&gt; 8
}

class Enrolment &lt; ActiveRecord::Base
  has_many :enrolment_presentations
  has_many :presentations, through: :enrolment_presentations

  enum status: STATUS_FLAGS
end


class EnrolmentPresentations &lt; ActiveRecord::Base
  belongs_to :enrolment
  belongs_to :presentation

  enum status: STATUS_FLAGS
end


This, of course, doesn't eliminate duplication. One way around that might be to use a module as a mixin (though I'm not sure how that would work with ActiveRecord) or use singular inheritance to create a class that extends ActiveRecord::Base with the enum status, and then inherit from that - though I have to admit it feels hacky extending Active Records through inheritance.

As a stylistic note, it appears that the convention for #enum is to use lowercase names rather than PascalCase.