RDoc Error: Directory doc already exists

In my Rails application direcotory, when I run "rdoc", I got an error message:

Directory doc already exists, but it looks like it
isn't an RDoc directory. Because RDoc doesn't want to risk
destroying any of your existing files, you'll need to
specify a different output directory name (using the
--op <dir> option).

That's because rails generated "doc" directory that rdoc don't like. To fix this, we can either use rake:

$ rake doc:app

Or specify another directory name to rdoc:

$rdoc --op rdoc_dir

If "rdoc_dir" does not exist, rdoc will create it for you. Then the contents in "rdoc_dir" from "rdoc" would be the same as those in the "doc/app" directory that you get from running rake.