Using join in a link_to

I’ve got this:

<% for tag in @tags -%>
<%= link_to tag.name, :controller => ‘archives’, :action => ‘tags’, :id
=> tag.safe_name %>
<% end -%>

I want to use the .join(", ") trick to stick a comma between the links,
where should I do this?

Hello Paul,

<% for tag in @tags -%>
<%= link_to tag.name, :controller => ‘archives’, :action => ‘tags’, :id
=> tag.safe_name %>
<% end -%>

I want to use the .join(", ") trick to stick a comma between the links,
where should I do this?

<%= @tags.collect { |tag| link_to tag.name, :controller => ‘archives’,
:action => ‘tags’, :id => tag.safe_name }.join(", ") %>

Not tested but it should work.

-- Jean-François.

Aha, got it… I used this instead.

<%= @tags.collect {|tag| link_to tag.name, :controller => ‘archives’,
:action => ‘tags’, :id => tag.safe_name}.join(", ") %>

Paul Livingstone wrote:

I’ve got this:

<% for tag in @tags -%>
<%= link_to tag.name, :controller => ‘archives’, :action => ‘tags’, :id
=> tag.safe_name %>
<% end -%>

I want to use the .join(", ") trick to stick a comma between the links,
where should I do this?
<%= @tags.collect{|tag| link_to… }.join(’, ') -%>

lol, thanks… we submitted that at the same time. I should’ve gave my
brain a few more minutes to cook over before posting here.

Thanks again though!