finished class for rails integration