Ruby on Rails 스터디 노트
  • Ruby on Rails 스터디 노트
  • 리소스
  • 릴리즈 노트 번역
    • 5.1
    • 5.2
    • 6.0 (Alpha)
  • Concern 사용하기
  • Gems
    • RuboCop
    • Annotate Model
    • Rails ERD
  • Model
    • UNIX Time (Milliseconds) 사용하기
  • Model Design
    • History Source
    • STI (Single Table Inheritance)
    • MTI (Multiple Table Inheritance)
    • Polymorphic Association
Powered by GitBook
On this page
  • 소개
  • 설치
  • 설정
  1. Gems

Rails ERD

PreviousAnnotate ModelNextUNIX Time (Milliseconds) 사용하기

Last updated 6 years ago

소개

ActiveRecord 모델들과 Associations로 부터 다이어그램을 뽑아주는 잼이다.

ERD라고는 하지만, 막상 보면 액티브레코드 시각화에 가깝다.

ERD 산출물로써는 활용하지 못하더라도 모델링이 잘못됐다면 이쁜 그림이 나올 수가 없으니 피드백으로써 꽤 쓸만하다.

설치

시각화 하는데 를 사용한다. 개발 환경에 graphviz가 설치되어 있지 않다면 설치해야한다.

Gemfile의 :development 그룹에 잼 선언을 추가한 후, bundle install을 실행한다.

group :development do
  gem 'rails-erd'
end

제공되는 레일즈 제너레이터를 사용해 레일즈와 통합할 수 있다.

rails g erd:install

설정

프로젝트 루트 경로에 .erdconfig 파일을 생성해서 기본 설정을 변경할 수 있다.

attributes:
  - content
  - foreign_key
  - inheritance
disconnected: true
filename: erd
filetype: pdf
indirect: true
inheritance: false
markup: true
notation: simple
orientation: horizontal
polymorphism: false
sort: true
warn: true
title: sample title
exclude: null
only: null
only_recursion_depth: null
prepend_primary: false
cluster: false
splines: spline
Gem
Source
Diagram Gallery
Graphviz