How can I replace dashes with a spaces & underscores with a commas at the same time?
I was able to replace underscores with commas, but when I tried to reiterate through the array again it gave some funky results.
Controller
def activity_by_all_city
@cities = ['Abilene_Texas','Akron_Ohio','Albuquerque_New-Mexico','Baton-Rouge_Louisiana']
end
View
<% @cities.each do |city|%>
<%= link_to city.gsub!(/_/, ', '), 'activities-'+city.parameterize %><br>
<% end %>
Try:
Gives: