converted to rails