Reputation: 3696
I have the following code in my view, I don't understand why the gsub doesn't work.
<div class="section" id="<%= section.title.gsub(/_/, ' ') %>">
When .title = "Test Title"
it just returns "Test Title"
rather than "Test_Title"
What's going wrong here?
Upvotes: 0
Views: 395
Reputation: 6088
It should be the other way around:
"Test Title".gsub(/ /, '_') #=> "Test_Title"
Upvotes: 2