undefined method `to_date' for nil:NilClass Did you mean? to_a