I'm generating documentation with Yard but i can't find any example documentations for ruby on rails projects. I have found only short getting started tutorial, and some github projects on rubydoc.info, but they are not documented at all. please could somebody show me how to properly document controllers(with actions), models, routes of rails project
for instance i have such controller:
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
And a user model:
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