Rails Documentation (API and Guides)

Online Documentation

The most up-to-date online documentation links can be found at the official Ruby on Rails web site (http://rubyonrails.org/documentation). These docs include:
 
Rails-specific
-- Rails Guide (http://guides.rubyonrails.org/): step-by-step guides from installing Ruby, writing Rails applications, debugging, testing, to deploying. It is up-to-date and comprehensive.
-- Rails complete API (http://api.rubyonrails.org/): update-to-date language reference
 
Ruby-specific
-- Ruby Standard Lib (http://ruby-doc.org/stdlib-1.9.3/)
 
The above links are APIs for the latest Ruby version. Docs for the previous Ruby versions can be downloaded at http://ruby-doc.org/downloads/
 
Offline Documentation
 
It is often useful to have an offline version of the documents. There are several ways to create the local versions. One way is using Rails. Rails provides commands to generate the docs once it is installed. However, as Rails upgrades, many commands that worked in lower versions (e.g., 2.x) of Rails no longer do in the newer version (3.x). Another way is to mirror the online docs directly using tools like wget. This process takes longer, but does not need to always search for the correct Rails commands. 
 
Rails-specific
-- Rails complete API: to mirror the Rails API, create a folder for holding the API, and then type:
wget -r -k -p -nH http://api.rubyonrails.org/, where 
  • -r: recursive;
  • -k: convert links to local pointers
  • -p: download required images
  • -nH: no host prefix. If not specified, all downloaded docs will be put under a folder named after the hotel name
-- Rails Guides
I learned to create an offline Rails Guides from Aslam Najeebdeen's blog. Do the following steps:
1. create a new Rails app
$rails new dummy_app
2. Rails Guilds needs a gem called RedCloth. To install this gem, type
$sudo gem install RedCloth
3. After the RedCloth is installed, navigation to the app home directory, open the file named "Gemfile", and added the following line in the file.
gem 'RedCloth'
4. Run the following Rake command to generate Rails Guides
$rake doc:guides
ignore the error output "fatal: Not a git repository (or any of the parent directories): .git", since this Rails is not installed from git repository
5. The "Rails Guides" docs are generated in the subdirectory doc/guides. Here is the structure of this directory:
dummy_app/doc/guides $ ls                         
2_2_release_notes.html credits.html
2_3_release_notes.html debugging_rails_applications.html
3_0_release_notes.html engines.html
3_1_release_notes.html form_helpers.html
3_2_release_notes.html generators.html
_license.html getting_started.html
_welcome.html i18n.html
action_controller_overview.html images
action_mailer_basics.html index.html
action_view_overview.html initialization.html
active_model_basics.html javascripts
active_record_basics.html layout.html
active_record_querying.html layouts_and_rendering.html
active_record_validations_callbacks.html migrations.html
active_resource_basics.html nested_model_forms.html
active_support_core_extensions.html performance_testing.html
ajax_on_rails.html plugins.html
api_documentation_guidelines.html rails_application_templates.html
asset_pipeline.html rails_on_rack.html
association_basics.html routing.html
caching_with_rails.html ruby_on_rails_guides_guidelines.html
command_line.html security.html
configuring.html stylesheets
contributing_to_ruby_on_rails.html testing.html
 
Ruby-specific
Ruby Core and Standard Library docs can be downloaded at http://ruby-doc.org/downloads/
posted @ 2013-03-16 12:11  小狸的窝  阅读(321)  评论(0)    收藏  举报