fixed spelling of capitalize and changed activerecord call to sql