From: Peter Hickman Date: 2010-07-13T18:22:14+09:00 Subject: Re: Why do I get undefined method? year == 2001..2006 means is the variable 'year' is a range starting with 2001 up to and including 2006 That is it expects that 'year' will be a range and not a fixnum. What you need is something like this if (2001..2006).include?(year)