Hassan Schroeder wrote in post #1177877: > On Wed, Aug 19, 2015 at 5:19 AM, Quake Live <li...@ruby-forum.com> > 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 ------------------------ hassan.schroe...@gmail.com > http://about.me/hassanschroeder > twitter: @hassan > Consulting Availability : Silicon Valley or remote
Sorry that I am answering that late. But this is exactly that what I was looking for (one month ago :P). -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f47f66673793a7b1b9aa1f226b8193dd%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.