rails-erd-d3 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rails_erd_d3.rb +11 -11
- data/lib/templates/d3.html.erb +1 -1
- data/lib/templates/modals.html.erb +1 -1
- data/rails-erd-d3.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 542b6427e59b1bbb3e1042ebb41e942879a68d65
|
4
|
+
data.tar.gz: 526b783214b37465688b996bd15e675a23a78c00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 781dc9c87f46d2403a767ac472d50fdd9f0eff6d12b8b61ca6b898feb21115bb7c52f7363c700942ec1932372fe329d3337ae081614014a2ae4232b42a5bbcd7
|
7
|
+
data.tar.gz: 670ced49a9380d4ef88b8309041016e8c886a8ae80dfd44bb02b026d813f857ef2a851776ba7fab5d265183de704a3458c9deb7fed58731df2baabc80b2ddf71
|
data/lib/rails_erd_d3.rb
CHANGED
@@ -43,24 +43,24 @@ class RailsErdD3
|
|
43
43
|
nodes = []
|
44
44
|
links = []
|
45
45
|
@@models.each do |model|
|
46
|
-
nodes << { label: model.name, r: 30 }
|
46
|
+
nodes << { table_name: model.table_name, label: model.name, r: 30 }
|
47
47
|
|
48
48
|
puts " - #{model.name}"
|
49
49
|
model.reflections.each do |name, reflection|
|
50
50
|
next if reflection.options[:polymorphic]
|
51
51
|
|
52
|
-
|
53
|
-
|
52
|
+
begin
|
53
|
+
association = reflection.macro.to_s + (reflection.options[:through] ? "_through" : "")
|
54
|
+
|
55
|
+
links << {
|
56
|
+
source: models_list[model.table_name],
|
57
|
+
target: models_list[reflection.table_name],
|
58
|
+
color: ASSOCIATIONS.index(association)
|
59
|
+
}
|
60
|
+
rescue
|
61
|
+
puts "Please ensure that association #{name} sets properly!"
|
54
62
|
next
|
55
63
|
end
|
56
|
-
|
57
|
-
association = reflection.macro.to_s + (reflection.options[:through] ? "_through" : "")
|
58
|
-
|
59
|
-
links << {
|
60
|
-
source: models_list[model.table_name],
|
61
|
-
target: models_list[reflection.table_name],
|
62
|
-
color: ASSOCIATIONS.index(association)
|
63
|
-
}
|
64
64
|
end
|
65
65
|
end
|
66
66
|
puts "Data were successfully generated."
|
data/lib/templates/d3.html.erb
CHANGED
@@ -53,7 +53,7 @@
|
|
53
53
|
.classed('node', true)
|
54
54
|
.style('cursor', 'pointer')
|
55
55
|
.attr('data-toggle', 'modal')
|
56
|
-
.attr('data-target', function(d) { return '#' + d.
|
56
|
+
.attr('data-target', function(d) { return '#' + d.table_name })
|
57
57
|
.attr('class', function(d) { return d.label })
|
58
58
|
.call(d3.drag()
|
59
59
|
.on('start', dragstarted)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% @@models.each do |model| %>
|
2
|
-
<div class="modal fade" id="<%= model.
|
2
|
+
<div class="modal fade" id="<%= model.table_name %>" tabindex="-1" role="dialog">
|
3
3
|
<div class="modal-dialog" role="document">
|
4
4
|
<div class="modal-content">
|
5
5
|
<div class="modal-header">
|
data/rails-erd-d3.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "rails-erd-d3"
|
7
7
|
spec.authors = ["Roman Krasavtsev"]
|
8
8
|
spec.email = ["mr.krasavtsev@gmail.com"]
|
9
|
-
spec.version = "0.9.
|
9
|
+
spec.version = "0.9.3"
|
10
10
|
spec.summary = "Entity–relationship diagram with D3.js for Rails application"
|
11
11
|
spec.description = "This gem creates entity–relationship diagram with D3.js for your Rails application"
|
12
12
|
spec.homepage = "https://github.com/RomanKrasavtsev/rails-erd-d3"
|