12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails でモデルの情報を図にする方法

Posted at

いちいち手で書いてられないですよね。間違えるし。。

というわけで Rails ERD を使ってみました。

準備

graphviz のインストール。

brew install graphviz

rails-erd のインストール

marvericks の場合、gem rails-erd をインストールする際に下記のように記載すること。

+ gem 'rails-erd', github: 'paulwittmann/rails-erd', branch: 'mavericks'

ただ rails-erd を指定しただけだと、下記のようなエラーを吐いて図が出力されない。

Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2014-05-23 11:50:20.918 dot[88308:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial Italic" and got font with PostScript name "Arial-ItalicMT". For best performance, only use PostScript names when calling this API.

実行

bundle install が終わったら、

bundle exec rake erd

を実行。Rails root に erd.pdf が生成されます。

12
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?