My code after following the rails cast for sunspot