refactor rails generator according to #6