Refactor rails version