[“100”,“101”,“102”,“103”,“104”,“105”] which is not the result that i was
looking for. (mentioned above)
As Hassan said, puts is not going to get it for you here. But a newline
will work as a line-break inside the content of a textarea. If you store
the string containing the newlines, and you show it inside a textarea,
it will preserve the newlines. You won’t need to do anything else to get
it to work. Set the value as containing the newlines in the controller,
and just display that default value in the view inside your textarea. If
you then want to show these values in an HTML context with the newline
characters replaced with break tags, then the easiest way to do that is
to simply run it through simple_format in your view.
So in your controller, in the edit method, you might set this up:
Sorry that I am answering that late. But this is exactly that what I was
looking for (one month ago :P). I forgot about this topic here, must be
because I found a solution by myself. But thanks aynway!
On Sat, Aug 22, 2015 at 8:25 AM, Walter Lee D. [email protected]
wrote:
As Hassan said, puts is not going to get it for you here. But a newline will
work as a line-break inside the content of a textarea. If you store the string
containing the newlines, and you show it inside a textarea, it will preserve the
newlines.
Gah, yes, my bad. Walter is correct - newlines are rendered as is
within the textarea. (I was thinking about outputting the result.)
I should know because I’ve used this before, i.e. to allow a user to
input a newline-separated set of response strings for a poll creation
tool. And it works fine