I think both if statements are related so it is better to bundle them. In the second statement you already expect a params[:password] to be set if there is no force_random. It seems better to put the exception handling there as well. This will also reduce the paths through the code (on first sight) from 4 to 3 (from two if/else statements to one if/elsif/else statement).