There’s an excellent guide to Rails 2 that I’m reading through right now, but I don’t like this bit:

    if @comment.save
redirect_to post_comment_url(@post, @comment)
else
render :action => "new"
end

It’s much better like this:

    render :action => "new" and return unless @comment.save
redirect_to post_comment_url(@post, @comment)

They do exactly the same thing, but mine is 2 lines instead of 5, and mine clearly eliminates the exceptional/error case first, and then leaves you to see the normal case. In fact, I virtually always code this way when I can, deal with the error cases first, and return, and then the rest of the function is an un-nested normal case handler.