Using rails 3.0.9 with ruby 1.9.2.
I have to make a list of places (which contains accents and non standard letters) to fill a select box.
Using a helper doesn't work (already searched it), as I get the following error:
invalid multibyte char (US-ASCII)
It apparently has something to do with ruby and not with rails.
I also read that the best solution is to put the list in a translation file, and so I did, but now I can't retrieve the list.
Before, I had:
def madrid_area_array
[
"Chapinería",
"Ciempozuelos",
"Cobeña",
]
end
Now, I have in my .yml:
places:
spain:
madrid:
chapin: "Chapinería"
ciempo: "Ciempozuelos"
cobena: "Cobeña"
When I used the helper (in case anyone wonders, symbols like í get literally written in select drop boxes, you don't get 'í'), I could call madrid_area_array to fill the select menu. Now, I can't call the translation file, and have to make an intermediate helper with translations:
def madrid_area_array
[
t(:chapin, :scope => "spain.madrid", :locale => "places"),
t(:ciempo, :scope => "spain.madrid", :locale => "places"),
t(:cobena, :scope => "spain.madrid", :locale => "places")
]
end
Is there any way to get all the entries from a translation subtree? like:
t(*, :scope => "spain.madrid", :locale => "places")