如何使用Rails或Ruby文檔?

[英]How to use Rails or Ruby documentation?


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

我來自C#,最近我開始編寫一些Ruby on Rails應用程序。

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.

我最大的問題是文檔,因為我發現它極難使用。例如,找到如何從我的控制器調用生成器花了我大約2小時,然后15分鍾后,我發現Rails :: Generators.invoke方法,以找出我應該傳遞給這個函數的參數。

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.

也許我用錯誤的方式使用文檔;首先,我瘋狂猜測並搜索Netbeans代碼完成,這很少有用,然后我在Google中搜索,然后使用API​​。

Can some experienced Rails programmer give me some advice?

有些經驗豐富的Rails程序員可以給我一些建議嗎?

3 个解决方案

#1


5  

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

我用Ruby / Rails文檔描述了我自己的個人工作流程:

  1. You can use ri and rdoc if you are familiar with the console, but...
  2. 如果您熟悉控制台,可以使用ri和rdoc,但......

  3. Personally, I recommend two very good Ruby/Rails documentation sites:

    就個人而言,我推薦兩個非常好的Ruby / Rails文檔站點:

    • apidock.com (no good search, but sometimes fine examples)
    • apidock.com(沒有很好的搜索,但有時很好的例子)

    • railsapi.com (very good AJAX search, plus you can customize what documentation you would like to see - by versions and by Gems)
    • railsapi.com(非常好的AJAX搜索,另外你可以自定義你想看到的文檔 - 版本和Gems)

#2


6  

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

如果您是初次使用rails,我建議您在深入了解API文檔之前閱讀一本書。

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.

在您完成這些書籍之后,您將了解Rails的設計方式以及在哪里尋找內容。

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

這兩本書都是很好的參考書。如果您想在線訪問Rails和Ruby API,請務必查看RailsApi.com

#3


0  

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

Rails指南的每次迭代(http://guides.rubyonrails.org/)都有很多有用的東西。那應該是第一站。

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

之后我在API中搜索 - http://api.rubyonrails.org。

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

有時我甚至最終只是閱讀源代碼試圖找到的東西 - 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.

我認為源代碼中最好的地方就是這里 - https://github.com/rails/rails/tree/master/railties/lib/rails。

I upvoted each of the other answers here.

我在這里贊成了其他每個答案。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/11/03/e5dc21a20716a247518fbae953de74e6.html



 
  © 2014-2022 ITdaan.com 联系我们: