Ruby and Ruby on Rails offline API documentation

20,312

Solution 1

Browser-based Solution – Updated Oct 19, 2017

DevDocs (https://devdocs.io/) uses your browser's IndexedDB to store the documentation you want. Make sure you follow the instructions on how to install the docs before you go offline.


For macOS try Dash

For Windows/Linux try Zeal

For packaged HTML try RubyDocs

Manual Download:

I used this commands on my server so I could get the files faster (they were cached, go figure).

wget -r -k -p http://api.rubyonrails.org/

  • r - recursive
  • k - convert links to point to local files
  • p - get all images, etc needed to display the html pages

Then I compress the folder so I can download it without overhead.

rar a -r rails_api.rar api.rubyonrails.org/

  • a - add files
  • r - recursive

https://gist.github.com/2149669

YARD Server

I prefer the yard format over rdoc.

  1. Install the gem gem install yard,
  2. Regenerate all the documentation gem rdoc --all --overwrite, and
  3. Run the server for the gems yard server --gems.

Solution 2

railsapi.com. You can build and download a custom package of docs for ruby versions to 1.9, rails to 2.3.5 and a number of gems.

Solution 3

I realize this question is quite old but since it still comes up high in Google when searching for "ruby on rails docs" and several people suggest railsapi.com, which has been down for almost a year.

So I wanted to mention http://rubydocs.org, which has the same functionalities that railsapi.com had and more (generate combined docs of Ruby and Rails with any version you need).

Disclaimer: I built http://rubydocs.org. :)

Solution 4

Within your rails project:

API:

rake doc:rails

Guides:

Add the RedCloth gem to your Gemfile

gem 'RedCloth'

Then

rake doc:guides

Solution 5

Edit (Feb 2016): http://devdocs.io/ looks okay

Just not to pass unmentioned, you can also start local gem rdoc server:

$ gem server
Starting gem server on http://localhost:8808/
localhost - - [13/Mar/2010:18:34:44 CET] "GET / HTTP/1.1" 200 22403
- -> /

But it lacks info on core Ruby library.

Share:
20,312
denisjacquemin
Author by

denisjacquemin

Updated on July 09, 2022

Comments

  • denisjacquemin
    denisjacquemin almost 2 years

    In the past I used railsbrain.com to have a nice and handy offline api documentation.

    But they stop at version 2.3.2

    Is there any other solution with latest version.

  • PJP
    PJP about 13 years
    +1 for gem server. Re: missing core library info, I think that the rdoc-data gem will help there.
  • Meltemi
    Meltemi almost 11 years
    +1 for Dash reference. Never heard of it before. I think I'm gonna like it!!
  • Damien Roche
    Damien Roche almost 11 years
    not found when you try download :( Dammit.
  • GregT
    GregT almost 11 years
    thanks for sharing a link to Dash. liking it so far!
  • PhilT
    PhilT over 10 years
    For later versions of Rubygems: gem rdoc --rdoc --all
  • CamelBlues
    CamelBlues almost 10 years
    Why do I have to wait for the docs to be prepared? Can't you just create all possible combinations and have them stored on the server?
  • Manuel Meurer
    Manuel Meurer almost 10 years
    RubyDocs currently tracks 281 Ruby versions and 213 Rails versions. All possible combinations would be close to 60,000. While it's totally possible to generate and store all those, it would be a waste of time and space since only a few are really useful I guess.
  • Anwar
    Anwar about 8 years
    Good answer. But, if I want to use yardoc instead of rdoc for api documentation, what do I need to do?
  • Anwar
    Anwar about 8 years
    Nice and very helpful. But, I I need yardoc instead, what should I do?
  • Jay Killeen
    Jay Killeen over 7 years
    DevDocs! Wow! Where have you been all my life?
  • jpgeek
    jpgeek about 7 years
    Awesome! Thank you!!
  • sufinsha
    sufinsha about 7 years
    I have used this gem on my project. It's good and very simple.