more sql work but in rails