Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. # frozen_string_literal: true
  2. # app/models/concerns
  3.  
  4. module HasStringEnum
  5. extend ActiveSupport::Concern
  6.  
  7. class_methods do
  8. def string_enum(name, values, **options)
  9. enum(name => values.zip(values).to_h, **options)
  10. end
  11. end
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement