Forum: Ruby Helper help

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.
Eaec1838b76398f2b3e91ada57ac0a73?d=identicon&s=25 Tomasz Tomczyk (Guest)
on 2007-01-25 18:56
(Received via mailing list)
I need a helper, which will render a table in my customized style.
I wrote a code like this:

<% @column_names = ["Name", "Age", "Sex"] %>
<%= table_show @column_name %>

def table_show(names)
  for name in names
    content_tag ( :div, name, :class => 'table_header' )

Which should give me an output like this:
  <div class='table_header'>Name</div>
  <div class='table_header'>Age</div>
  <div class='table_header'>Sex</div>

Unfortunately I have only one line of output which looks like:

After few trials it seems, that this output is being generated by line:
"for name in names", because deleting "content_tag..." doesn't make any

What am I doing wrong?
I suppose that helper def does treat an Array like a String...

Tomasz Tomczyk
852a62a28f1de229dc861ce903b07a60?d=identicon&s=25 Gavin Kistner (phrogz)
on 2007-01-25 19:46
(Received via mailing list)
On Jan 25, 10:52 am, "Tomasz Tomczyk" <> wrote:
> I need a helper, which will render a table in my customized style.

You will probably get a better response if you ask this on the Ruby on
Rails mailing list. The Ruby-talk mailing list (and forum, and
comp.lang.ruby newsgroup) is primarily for discussion of the Ruby
language itself, not the Ruby on Rails web framework that happens to
use it.
This topic is locked and can not be replied to.