Annotate Models

Annotate Rails classes with schema and routes info
Icons/chart bar
Used 432 times
Created by
D Drew Reynolds

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/Vqqsqg"
Template Source

Review the code before running this template on your machine.

gem_group :development do
  gem 'annotate'
end

if yes?("Would you like to annotate all your models, tests, fixtures, and factories?")
  run("annotate")
else
  if yes?("Would you like to annotate just your models?")
	run("annotate --models")
  end
  
   if yes?("Would you like to annotate just your routes?")
	run("annotate --routes")
  end
end

if yes?("Would you like to annotate every time you run db:migrate?")
  run("rails g annotate:install")
end
Comments

Sign up or Login to leave a comment.