On Wed, Aug 19, 2015 at 5:19 AM, Quake Live <[email protected]> wrote:
> My idea was to convert the String to an Array and print each element of
> the Array. But it did not work. Here is what it is looking like:
>
> <%= f.text_area :number, :value => s.some_string.nil? "" :
> s.some_string.split(',').each {|number| puts "#{number}," } %>
Your first problem is using `puts` in a view; `puts` writes to stdout -
you want the values rendered in the web page.
Second problem is that a newline is just a whitespace character in
HTML; you probably want something like
s.some_string.split(',').join(",<br />").html_safe
HTH,
--
Hassan Schroeder ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yBTARD3xt%3D3kpPNVpuQ3ptniB2Xn%3D143WbU_e-b-_0CwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.