translate_enum
translate_enum copied to clipboard
translate_enum in my model causes "is already defined by another enum" error
My setup Model.rb
enum :o_type, [:ordinary, :straordinary, :warranty]
translate_enum :o_type
Adding prefix: true changes nothing, removing translate_enum :o_type resolves the issue but then I cant use the gem obviously. Does it have anything to do with the new enum syntax?
I saw this exception as well. I resolved it by adding include TranslateEnum.
class TranslatedModel < ApplicationRecord
include TranslateEnum # <---
# ...
end