rails-erd-d3 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85e33cc8ab91d38fee8e247dba967ba328928fe6
4
- data.tar.gz: 5c4c8206651a07fb09b995e6f17375ee426382f6
3
+ metadata.gz: 1e094a25abe08eb2e696160d5eb8d9d190eb7801
4
+ data.tar.gz: 6efb119e4bef70e1bec1e84116fb741b112ed5a5
5
5
  SHA512:
6
- metadata.gz: bb2b23ac29a7f1940c868cd9f3befb0db7fc1ba24522039523e703eaafcdbb46e72432f9322426ba75b881f1db14cf7b94cde203e6204eb351558c3f3625246a
7
- data.tar.gz: 4486d4486a6b76241628900c03956b3b0ce284dfe4beb09ea8f81f29c1cc021929d3b66f0f735c3dfbe6c3995817f714ea7cb44929eac85657372dbed57db5c6
6
+ metadata.gz: a44528087f73fe3b39f734eef415cd9376a02b65600f25891c46d89b0fcca117cd4a99b519d8c34deca01d189b6cae4a0a940cb4f4824e47185ad6420359dcbd
7
+ data.tar.gz: 4a86a8eddb82f39c176c156f6d113cf4dfc4032b1e1cdb19f01ac1e465381cbdb1e84abc9106f4cc446d81830bcbe04f6600a68e59b8fda663ee9f983e475564
data/README.md CHANGED
@@ -8,6 +8,9 @@
8
8
 
9
9
  Create entity–relationship diagram with D3.js for your Rails application.
10
10
 
11
+ ## Demo
12
+ [https://romankrasavtsev.github.io/rails-erd-d3/](https://romankrasavtsev.github.io/rails-erd-d3/)
13
+
11
14
  ## Features
12
15
  Rails-ERD-D3 contains the following functionality:
13
16
 
Binary file
Binary file
Binary file
data/lib/rails_erd_d3.rb CHANGED
@@ -26,7 +26,7 @@ class RailsErdD3
26
26
 
27
27
  Rails.application.eager_load!
28
28
  klass.connection
29
- @@models = ObjectSpace.each_object(Class).select { |o| o.superclass == klass } || []
29
+ @@models = ObjectSpace.each_object(Class).select { |o| o.ancestors.include? klass } || []
30
30
  end
31
31
 
32
32
  def self.get_data
@@ -46,13 +46,18 @@ class RailsErdD3
46
46
  model.reflections.each do |refl_name, refl_data|
47
47
  next if refl_data.options[:polymorphic]
48
48
 
49
- refl_model = (refl_data.options[:class_name] || refl_name).underscore
49
+ refl_model = (refl_data.options[:class_name] || refl_name).to_s.underscore
50
50
  association = refl_data.macro.to_s + (refl_data.options[:through] ? "_through" : "")
51
51
  color_index = ASSOCIATIONS.index(association)
52
52
 
53
+
54
+ targeted_model = refl_model
55
+ targeted_model = targeted_model[1..-1] if targeted_model.starts_with?('/')
56
+ targeted_model = targeted_model.tr('/', '_').pluralize.capitalize
57
+
53
58
  links << {
54
59
  source: models_list[model.model_name.plural.capitalize],
55
- target: models_list[refl_model.pluralize.capitalize],
60
+ target: models_list[targeted_model],
56
61
  color: color_index
57
62
  }
58
63
  end
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.3.3"
9
+ spec.version = "0.4.0"
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"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erd-d3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Krasavtsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-14 00:00:00.000000000 Z
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler