Yard でドキュメントを生成していますが、Ruby on Rails プロジェクトのサンプル ドキュメントが見つかりません。短い入門チュートリアルとrubydoc.infoのいくつかの github プロジェクトしか見つかりませんでしたが、それらはまったく文書化されていません。Railsプロジェクトのコントローラー(アクション付き)、モデル、ルートを適切に文書化する方法を教えてください。
たとえば、私はそのようなコントローラを持っています:
class ArticlesController < ApplicationController
before_filter :authenticate_user!, except: [:show]
before_filter :restrict_user, only: [:edit, :update]
def index
@articles = current_user.articles.sort_by_rating.
paginate(:page => params[:page],
per_page: 5)
end
def new
@user = User.find(params[:user_id])
@article = @user.articles.build
end
def create
@user = User.find(params[:user_id])
@article = @user.articles.build(params[:article])
if @article.save
redirect_to @article, notice: 'Article was successfully created.'
else
render action: "new"
end
end
end
そしてユーザーモデル:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable :recoverable
devise :database_authenticatable, :registerable,
:rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :name, :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body
validates_presence_of :name
validates_uniqueness_of :name, :email, :case_sensitive => false
has_many :articles, dependent: :destroy
letsrate_rater
end