Forum: Rails I18n get an array from an I18n declaration?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
patrick99e99 (Guest)
on 2011-06-30 18:44
(Received via mailing list)

I am storing some text in a model that is separated by new lines, and
I wanted to offer some default text in case the records in the model
do not exist...  So I tried to emulate it by doing:


..  However, when I retrieve this, it shows up as item1\\r\\nitem2\\r\

where the "\"s are escaped.......  So in order to split my string by
new lines, I have to do:
text.split(/\r\n|\\r\\n/), which I am not crazy about.

I was wondering if there is a simple way I can just make a list in
yaml so that when I do t(:foo), i will get ["item1", "item2",
"item3"] ?


Martin S. (Guest)
on 2011-06-30 19:08
(Received via mailing list)
    - "item one"
    - "item two"
    - "item three"

 => ["item one", "item two", "item three"]

- Martin
Henrik -. (Guest)
on 2011-06-30 19:08
(Received via mailing list)
Did you try the YAML docs or a quick search? Pretty sure it's
supported and shouldn't be hard to find.

Sent from my iPhone
patrick99e99 (Guest)
on 2011-06-30 21:39
(Received via mailing list)
awesome.. thanks!
This topic is locked and can not be replied to.