I have a list of values in url/title pairs that I\'d like to display. (More specifically, each object has its own list of links, some with 0, some with 1, some with more.) I w
Try putting this in your ApplicationHelper
def sep(separator)
->(a, b){ a << separator.html_safe << b }
end
Then do this in your template
links.map{|wl| link_to wl.title, wl.url}.reduce(&sep(", "))
You can use any separator you like this way. You also don't need to call html_safe
on the whole thing either. Only the separator. So this method is more secure.