I18n translate enum

1

I have an enum in my model containing the states, and I created a translation for it with I18n but it gives the following error:

  

translation data {...} can not be used with: count = > 1

My enum:

unless instance_methods.include? :uf
  enum uf: {
      AC: 12,
      AL: 27,
      AM: 13,
      AP: 16,
      BA: 29,
      CE: 23,
      DF: 53,
      ES: 32,
      GO: 52,
      MA: 21,
      MG: 31,
      MS: 50,
      MT: 51,
      PA: 15,
      PB: 25,
      PE: 26,
      PI: 22,
      PR: 41,
      RJ: 33,
      RN: 24,
      RO: 11,
      RR: 14,
      RS: 43,
      SC: 42,
      SE: 28,
      SP: 35,
      TO: 17,
      EX: 0,
  }
end

My en-pt

activerecord:
  attributes:
    city:
      uf:
        AC: "Acre"
        AL: "Alagoas"
        AM: "Amazonas"
        AP: "Amapá"
        BA: "Bahia"
        CE: "Ceará"
        DF: "Distrito Federal"
        ES: "Espírito Santo"
        GO: "Goiás"
        MA: "Maranhão"
        MG: "Minas Gerais"
        MS: "Mato Grosso do Sul"
        MT: "Mato Grosso"
        PA: "Pará"
        PB: "Paraíba"
        PE: "Pernambuco"
        PI: "Piauí"
        PR: "Paraná"
        RJ: "Rio de Janeiro"
        RN: "Rio Grande do Norte"
        RO: "Rondônia"
        RR: "Roraima"
        RS: "Rio Grande do Sul"
        SC: "Santa Catarina"
        SE: "Sergipe"
        SP: "São Paulo"
        TO: "Tocantins"
        EX: "Exterior"

How do I solve this problem?

    
asked by anonymous 09.04.2015 / 19:58

1 answer

1

I believe that what you are looking for has been answered here:

link

    
10.04.2015 / 19:45