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?
--
Posted via http://www.ruby-forum.com/.
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. -- ? la renverse.
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('', '') -%> -- Alex
Aha, got it.. I used this instead.
<%= @tags.collect {|tag| link_to tag.name, :controller =>
''archives'',
:action => ''tags'', :id => tag.safe_name}.join(",
") %>
--
Posted via http://www.ruby-forum.com/.