I need a helper, which will render a table in my customized style. I wrote a code like this: template.rhtml: <% @column_names = ["Name", "Age", "Sex"] %> <%= table_show @column_name %> helper.rb def table_show(names) for name in names content_tag ( :div, name, :class => ''table_header'' ) end end 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: NameAgeSex 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 differences. What am I doing wrong? I suppose that helper def does treat an Array like a String... Regards, Tomasz Tomczyk --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Tomasz, Tomasz Tomczyk wrote:> 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: > NameAgeSexAre you saying you have one _visible_ line? Or that, when you look at the DOM you''ve actually got one string? Without seeing your code, my first guess would be that you''ve got a CSS problem, not a Rails problem. You might want to try the block form of content_tag, just to help separate the issues. hth, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Finally I''ve found the problem - it was me :-) There was no return clause in the helper, which caused it to print everything in "for" loop. Now its OK. Thanks anyway, Tomasz Tomczyk --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---