简体   繁体   中英

How to use Rails or Ruby documentation?

I'm coming from C#, and recently I started to write some Ruby on Rails applications.

My biggest problem with it is the documentation because I find it extremly difficult to use. For example, finding out how to call generator from my controller took me about 2 hours and then 15 minutes after that I found Rails::Generators.invoke method to figure out what arguments should I pass to this function.

Maybe I use the documentation the wrong way; First I take a wild guess and search in the Netbeans code completion, which is rarely helpful, then I search in Google, then go with the API.

Can some experienced Rails programmer give me some advice?

If you're new to rails I recommend you read a book before you dive into the API documentation.

Here are two recommendations:

After you've worked your way through those books, you'll have an idea of how Rails is designed and where to look for stuff.

Both books are great reference books. If you want to access the Rails and Ruby API's online, make sure to checkout RailsApi.com

I am describing my own very personal workflow with Ruby/Rails documentation:

  1. You can use ri and rdoc if you are familiar with the console, but...
  2. Personally, I recommend two very good Ruby/Rails documentation sites:

    • apidock.com (no good search, but sometimes fine examples)
    • railsapi.com (very good AJAX search, plus you can customize what documentation you would like to see - by versions and by Gems)

Every iteration of the Rails guides (http://guides.rubyonrails.org/) has a ton of useful stuff in it. That should be the first stop.

After that I search away in the API - http://api.rubyonrails.org .

Sometimes I even end up just reading the source code trying to find things - https://github.com/rails/rails .

I think the best place in the source code to be reading is in here - https://github.com/rails/rails/tree/master/railties/lib/rails .

I upvoted each of the other answers here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM