问题
$ ri link_to
Nothing known about .link_to
Actually, it seems that ri knows nothing about Rails. But ri --list-doc-dirs
shows the Rails folders are included:
/usr/share/ri/1.8/system
/usr/share/ri/1.8/site
/root/.rdoc
/usr/lib64/ruby/gems/1.8/doc/actionmailer-2.3.5/ri
/usr/lib64/ruby/gems/1.8/doc/actionpack-2.3.5/ri
/usr/lib64/ruby/gems/1.8/doc/activerecord-2.3.5/ri
/usr/lib64/ruby/gems/1.8/doc/activeresource-2.3.5/ri
/usr/lib64/ruby/gems/1.8/doc/activesupport-2.3.5/ri
/usr/lib64/ruby/gems/1.8/doc/cgi_multipart_eof_fix-2.5.0/ri
/usr/lib64/ruby/gems/1.8/doc/columnize-0.3.5/ri
/usr/lib64/ruby/gems/1.8/doc/daemons-1.0.10/ri
/usr/lib64/ruby/gems/1.8/doc/fastthread-1.0.1/ri
/usr/lib64/ruby/gems/1.8/doc/gem_plugin-0.2.3/ri
/usr/lib64/ruby/gems/1.8/doc/json-1.6.3/ri
/usr/lib64/ruby/gems/1.8/doc/linecache-0.46/ri
/usr/lib64/ruby/gems/1.8/doc/macaddr-1.0.0/ri
/usr/lib64/ruby/gems/1.8/doc/mime-types-1.17.2/ri
/usr/lib64/ruby/gems/1.8/doc/mongrel-1.1.5/ri
/usr/lib64/ruby/gems/1.8/doc/mongrel_cluster-1.0.5/ri
/usr/lib64/ruby/gems/1.8/doc/multipart-post-1.1.4/ri
/usr/lib64/ruby/gems/1.8/doc/postgres-0.7.9.2008.01.28/ri
/usr/lib64/ruby/gems/1.8/doc/rack-1.0.1/ri
/usr/lib64/ruby/gems/1.8/doc/rake-0.8.7/ri
/usr/lib64/ruby/gems/1.8/doc/rbx-require-relative-0.0.5/ri
/usr/lib64/ruby/gems/1.8/doc/rdoc-3.12/ri
/usr/lib64/ruby/gems/1.8/doc/rdoc-tags-1.2/ri
/usr/lib64/ruby/gems/1.8/doc/rest-client-1.6.7/ri
/usr/lib64/ruby/gems/1.8/doc/ruby-debug-0.10.4/ri
/usr/lib64/ruby/gems/1.8/doc/ruby-debug-base-0.10.4/ri
/usr/lib64/ruby/gems/1.8/doc/sqlite3-ruby-1.2.4/ri
/usr/lib64/ruby/gems/1.8/doc/uuidtools-2.1.1/ri
What's wrong with it?
UPDATE
I found these yaml files in the folder of /usr/lib64/ruby/gems/1.8/doc/actionpack-2.3.5/ri/ActionView/Helpers/UrlHelper/
:
button_to-i.yaml cdesc-UrlHelper.yaml current_page%3f-i.yaml link_to-i.yaml link_to_if-i.yaml link_to_unless-i.yaml link_to_unless_current-i.yaml mail_to-i.yaml url_for-i.yaml
But in another system where the ri works well, the files are *.ri
, not *.yaml
.
回答1:
Have you tried running:
gem rdoc rails
From the docs:
Summary:
Generates RDoc for pre-installed gems
Description:
The rdoc command builds RDoc and RI documentation for installed gems. Use
--overwrite to force rebuilding of documentation.
回答2:
I have found that the only reliable way of installing the ri docs is this (i.e it installs the latest Rails including the ri docs):
sudo gem install rails --pre --ri
来源:https://stackoverflow.com/questions/8738750/why-doesnt-ri-know-anything-about-rails