Browse Source

Initialized rails-erd gem to generate an ERD schema based on rails models

Lou 2 years ago
parent
commit
b60c2d95a2
4 changed files with 14 additions and 2 deletions
  1. 2
    0
      Gemfile
  2. 10
    0
      Gemfile.lock
  3. 2
    2
      app/models/activity.rb
  4. BIN
      erd.pdf

+ 2
- 0
Gemfile View File

@@ -34,6 +34,8 @@ group :development do
34 34
   gem 'listen', '~> 3.3'
35 35
   # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
36 36
   gem 'spring'
37
+  # Generate erd (UML) schema from rails models
38
+  gem 'rails-erd'
37 39
 end
38 40
 
39 41
 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem

+ 10
- 0
Gemfile.lock View File

@@ -66,6 +66,7 @@ GEM
66 66
       msgpack (~> 1.0)
67 67
     builder (3.2.4)
68 68
     byebug (11.1.3)
69
+    choice (0.2.0)
69 70
     concurrent-ruby (1.1.8)
70 71
     crass (1.0.6)
71 72
     erubi (1.10.0)
@@ -119,6 +120,11 @@ GEM
119 120
     rails-dom-testing (2.0.3)
120 121
       activesupport (>= 4.2.0)
121 122
       nokogiri (>= 1.6)
123
+    rails-erd (1.6.1)
124
+      activerecord (>= 4.2)
125
+      activesupport (>= 4.2)
126
+      choice (~> 0.2.0)
127
+      ruby-graphviz (~> 1.2)
122 128
     rails-html-sanitizer (1.3.0)
123 129
       loofah (~> 2.3)
124 130
     railties (6.1.3.1)
@@ -131,6 +137,9 @@ GEM
131 137
     rb-fsevent (0.10.4)
132 138
     rb-inotify (0.10.1)
133 139
       ffi (~> 1.0)
140
+    rexml (3.2.5)
141
+    ruby-graphviz (1.2.5)
142
+      rexml
134 143
     spring (2.1.1)
135 144
     sprockets (4.0.2)
136 145
       concurrent-ruby (~> 1.0)
@@ -163,6 +172,7 @@ DEPENDENCIES
163 172
   listen (~> 3.3)
164 173
   puma (~> 5.0)
165 174
   rails (~> 6.1.3, >= 6.1.3.1)
175
+  rails-erd
166 176
   spring
167 177
   sqlite3 (~> 1.4)
168 178
   table_print (~> 1.5)

+ 2
- 2
app/models/activity.rb View File

@@ -1,8 +1,8 @@
1 1
 class Activity < ApplicationRecord
2 2
   belongs_to :author, class_name: "User"
3 3
   
4
-  has_one :joined_user_activities
5
-  has_one :user, :through => :joined_user_activities
4
+  has_one :joined_user_activity
5
+  has_one :user, :through => :joined_user_activity
6 6
 
7 7
   validates :name, presence: true
8 8
   validates :author, presence: true

BIN
erd.pdf View File


Loading…
Cancel
Save