convert to rails