Problem rendering several partials from an helper

Hi guys,

I must be missing something obvious, but I can't get my head around this:

In a view, if I do:

<% for i in 1..3 %>    <%= render :partial => 'test' %> <% end %>

(note: _test just displays a string)

it works just fine. But if I move this into the corresponding helper:

<%= test_helper() %>

with (in the helper):

def test_helper    for i in 1..3        render :partial => 'test'    end end

it displays in my page: 1..3 as if test_helper had returned the string "1..3".

Any idea what is wrong with this code?

Thanks a lot! Peter

def test_helper for i in 1..3 render :partial => 'test' end end

it displays in my page: 1..3 as if test_helper had returned the string "1..3".

Which is exactly what it returned - for x in y; end evaluates to y. You're rendering partials but then discarding the results. You need to be hanging onto the results of the renders and joining them together (and then return that)

Fred

Thanks a lot Fred. That was it.

Peter.