(2011..1995).to_a
returns an array
(Time.now.year.to_i..1995).to_a
doesn't. Why?
try
> 2011.downto(1995).to_a
=> [2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995]
You can use this
(Time.now.year.to_i).downto(1995).to_a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With