ER -DIAGRAMS IN RAILS4
Entity relationship diagrams are a great way to quickly visualize the structure of a Rails database & project.
In this post, we'll get up and running with the
rails-erd
gem which will allow us to quickly generate ERD diagrams. After that, we'll set up a rake task so that everyone on the project uses the same command to generate the diagrams. Finally, we'll show off the diagram in the readme of our Github Project!
STEP 1: Install Graphviz (Rails ERD requires Graphviz.)
$sudo apt-get install graphviz
STEP 2:Add ‘rails-erd’ gem to your existing app’s Gemfile
gem 'rails-erd'
STEP 3:Run bundle command
$bundle
STEP 4: Open your app console and run the below command.
[app path]$bundle exec rake erd filetype=pdf
[OR]
[app path]$ bundle exec rake erd filetype=dot
Now go to your application root directory, you will get there erd.pdf or erd.dot file.
@@@@@@@HAPPY RAILS CODING@@@@@@
No comments:
Post a Comment