Ruby on Rails Saturday, August 22, 2015

Just curious... What are your plans for this unusual use of a text_area?  Planning on a multiple select, perhaps? Will the display be read-only?  Liz


On Wednesday, August 19, 2015 at 8:21:01 AM UTC-4, Ruby-Forum.com User wrote:
Hi guys,

I got a small problem. I want to give a text_area a default value.
The default value is a range of numbers, seperated with a comma.

So the first thing which is given is a String that looks like followed:
some_string = "100,101,102,103,104,105"

Now there is a text_area given. It content should be the String
"some_string". The ouput should look like this here:

100,
101,
102,
103,
104,
105

So after each "comma" new line.

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}," } %>


It will print this here:

["100","101","102","103","104","105"] which is not the result that i was
looking for. (mentioned above)


Any ideas?

--
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+unsubscribe@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/ca234ad0-0675-45b9-83e3-e581ba51391d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment