Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. class ApplicationRecord < ActiveRecord::Base
  2. self.abstract_class = true
  3.  
  4. def self.human_enum_name(enum_name, enum_value)
  5. enum_i18n_key = enum_name.to_s.pluralize
  6. I18n.t("activerecord.attributes.#{model_name.i18n_key}.#{enum_i18n_key}.#{enum_value}")
  7. end
  8. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement