How to read local Rails documentation with ri/rdoc tools?

741 views Asked by At

I want to read documentation of gems in terminal. How can I do this with ri tools? LinuxMint 18.3 Rails 5.1.4

1

There are 1 answers

2
Josh On

First, make sure you have the Docs on your system. They do not always install with a typical Rails installation.

You can download the doc for a specific gem with

gem rdoc [gem-name] --no-rdoc

The --no-rdoc tells it not to install the HTML version.

If you want the docs for all gems you have installed, you can use

gem rdoc --all --ri --no-rdoc

That may take a few minutes to download.

Once you have the docs downloaded, you can access them with

ri -i

This will give you an interactive prompt where you can search for gems or methods. You can even use tab to autocomplete.