I just noticed that you're using the 'and' keyword, that should be avoided and you should always use the double ampersand (&&) for logical operations.

Here's a great blog post showing how to avoid the little quirks in the Ruby language: http://blog.elpassion.com/ruby-gotchas/