simple regex -- replace underscore with a space

regex, ruby, ruby-on-rails, string

Solution

Whoops, I actually had it working--just forgot to update the variable name :P

I was using this:

@id = params[:id]
@title = @id.gsub("_", " ")

Problem

Hey, I'm writing my first Rails app, and I'm trying to replace the underscores form an incoming id name with spaces, like this: before: test_string after: test string How can I do this? Sorry if this is a bit of a dumb question, I'm not very familiar with regular expressions...

Original source