Created
November 23, 2016 12:20
-
-
Save jrom/0c4e4b73569e70f4780cd2898d664f8d to your computer and use it in GitHub Desktop.
Data model for Rails app using rails_erd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :datamodel do | |
desc 'Generates data model in erd.pdf' | |
task :generate do | |
#say 'Loading application environment...' | |
Rake::Task[:environment].invoke | |
require 'rails_erd/diagram/graphviz' | |
#say 'Loading all models...' | |
Rails.application.eager_load! | |
::Rails::Engine.subclasses.map(&:instance).map {|e| e.class.eager_load!} | |
#say 'Generating erd.pdf...' | |
RailsERD::Diagram::Graphviz.create | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment