Try <%= profile.show_types.join(',') %>
Hi --
Oops! For some reason I didn't the second half of the email Looks like he did what you suggested below, though his follow-up email arrived before his original email...
BTW, I have Ruby for Rails and it's great! Thanks!
Joshua,
Another way I do it is to use rails' to_sentence.
Show types: <%= profile.show_types.collect(&:name).to_sentence %>
yields
Show types: DJ, Live Set and Instrumental
And to_sentence is much clearer too.
Hope this helps, Trey
I don't think you'd be able to use the collect shortcut, but it would go something like:
<%= profile.show_types.collect{|t| link_to t.name, url_for(:controller => 'show_types', :action => 'show', :id => t.id)}.to_sentence %>
Trey
Joshua Muheim wrote:
Daniel Higginbotham wrote:
BTW, I have Ruby for Rails and it's great! Thanks!
+1
I had a good look at it in a bookshop yesterday, and ended up buying it (and also Ruby Cookbook, which looks very useful too)