Ruby on Rails
OfflineDocumentation

API documentation

There are a number of options for accessing the API documentation offline.

ri

You can use the ri (ruby interactive) command. Generate the rdoc from Rails and install it system-wide (feeding it to @ri@) by doing this:

Switch to your Rails source directory (I installed it with gem and run Gentoo Linux, so my directory location looks like the following).


$ cd /usr/lib/ruby/gems/1.8/gems/

Then parse the code, hunting for rdoc strings, build it all, and install it system-wide. (I have to be a user with administrative priviliges (root) to do this.)


$ rdoc -Y

ALTERNATIVE: Without admin privileges, you can install the rdoc in your homedir with:


$ rdoc —ri

I’ve found rdoc -Y hangs on Rails (1.1.6) it is better to run it in the individual directories you want to build: actionpack, actionmailer, actionwebservices, activerecord, activesupport, and rake. Avoid the rails directory as it appears to be the problem. I believe the rails directory doesn’t have any useful rdoc information. The aforementioned packages should contain everything that composes rails. (Rdoc fails because it is trying to parse an erb template as plain ruby code.)

Note that this is very processor and disk intensive activity, and might cause your computer to feel like it is eating a boomerang made of peyote. I highly recommend that you run it in tandem with the nice command to limit the impact of your processor’s temporary anguish on your computing experience.

gem_server

You can run the gem server to access the rdoc for any installed gem:


$ gem_server

Official rdoc-generated API

You can download the official rdoc-generated API documentation Look in the doc directory.

Generate rails HTML documentation

You can generate the rails API documentation as follows:

  1. Create a dummy rails application: rails dummy
  2. Change to the application you just created: cd dummy
  3. Freeze the Rails gems in the application: rake rails:freeze:gems
  4. Build the documentation: rake doc:rails

The documentation will be generated in the doc/api directory inside your Rails application. Move this folder to somewhere suitable, and then you can delete the dummy application.

Generate a CHM file

Refer to the page: HowToGenerateChmForRails.
There are CHM readers for both Linux (xchm) and Mac OS X (chmox).

Use a Firefox plugin

DevBoi is a Firefox sidebar plugin that has help for Rails. Once it is installed, you may need to install the additional Rails API package.

DevBoi update for rails 2.0.2 offline version

Documentation from this Wiki

Snapshots are no longer available. wget is your friend.