trim isn't a method on Ruby strings. Use strip.

I've been writing too much Javascript recently.