0
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
mine en
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 to solve this problem?
Which version of Rails?
– Alex Takitani
I’m using version 4.2.1
– Daniel
And how you’re using in the view?
– Alex Takitani
It makes a mistake to create the simple_form. Ex: f. input :Uf
– Daniel
I believe what you are looking for has been answered here: https://stackoverflow.com/a/23710247/151913
– Alex Takitani