rails-erd 1.6.0 → 1.6.1

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
- SHA256:
3
- metadata.gz: 92187ba08cd1adaa824abac10a7b33b94d5c5659bbc2177e628fac853e28fa4c
4
- data.tar.gz: cfde87f41307742ca046d9b6c899f9f71211c13e1a6294ef03aeea082b6a4d8e
2
+ SHA1:
3
+ metadata.gz: 16bfef1b79087e3017df7723bef8cf286df5a812
4
+ data.tar.gz: 7162f90b6dce224a0ec89693e7d307fbc15a9b45
5
5
  SHA512:
6
- metadata.gz: df5946aeffa73955192e36dc3a6de6a66f824f6537af8cae9575f9b2f3e14ab5bef28464573b5615a9a12381cf74fe23bc332e5caa5e0774f6cccf42c8739e27
7
- data.tar.gz: 34609d17ee199b9c39b92eb87885665d89b1db42a968a6f58cf2c508a8a42e9a4d4a1ac22ab3b2cd60b2ed57c119580211e4514102f5008fce38408dd8527382
6
+ metadata.gz: 34e2582512bfe6313f626d4de969eebc328415c97456b1cd151df3e19d75e55cc0b65a9ded7ba0c363d3708072d001266d96657e2a8669ee6a7c4ca7b0cc3ee0
7
+ data.tar.gz: 16ddf4ba4c7d640a4c139905fe6f238f76c70cf20712c467ebb9bf9075f0ee6603c0c532114b86bd0e66f7d275f5ae0200802e91c8978a469c6e39208dd3c709
@@ -49,7 +49,13 @@ module RailsERD
49
49
  # Returns the domain model name, which is the name of your Rails
50
50
  # application or +nil+ outside of Rails.
51
51
  def name
52
- defined? Rails and Rails.application and Rails.application.class.parent.name
52
+ return unless defined?(Rails) && Rails.application
53
+
54
+ if Rails.application.class.respond_to?(:module_parent)
55
+ Rails.application.class.module_parent.name
56
+ else
57
+ Rails.application.class.parent.name
58
+ end
53
59
  end
54
60
 
55
61
  # Returns all entities of your domain model.
@@ -1,4 +1,4 @@
1
1
  module RailsERD
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  BANNER = "RailsERD #{VERSION}"
4
4
  end
data/test/test_helper.rb CHANGED
@@ -16,6 +16,14 @@ if ActiveSupport::TestCase.respond_to?(:test_order=)
16
16
  ActiveSupport::TestCase.test_order = :random
17
17
  end
18
18
 
19
+ # Patch to make Rails 6.1 work.
20
+ module Kernel
21
+ # class_eval on an object acts like singleton_class.class_eval.
22
+ def class_eval(*args, &block)
23
+ singleton_class.class_eval(*args, &block)
24
+ end
25
+ end
26
+
19
27
  class ActiveSupport::TestCase
20
28
  include RailsERD
21
29
 
@@ -171,6 +179,11 @@ class ActiveSupport::TestCase
171
179
 
172
180
  parts[1..-1].inject([[Object, parts.first.to_sym]]) do |pairs,string|
173
181
  last_parent, last_child = pairs.last
182
+ # Fixes for Rails 6. No idea if this is actually correct as I can't decipher what the heck is going on in this
183
+ # code.
184
+ if last_child == :ActiveRecord || last_child == :primary
185
+ break []
186
+ end
174
187
 
175
188
  break pairs unless last_parent.const_defined?(last_child)
176
189
 
@@ -3,9 +3,9 @@ require File.expand_path("../test_helper", File.dirname(__FILE__))
3
3
 
4
4
  class AttributeTest < ActiveSupport::TestCase
5
5
  def with_native_limit(type, new_limit)
6
- ActiveRecord::Base.connection.class_eval do
6
+ ActiveRecord::Base.connection.singleton_class.class_eval do
7
7
  undef :native_database_types
8
- define_method :native_database_types do
8
+ define_method(:native_database_types) do
9
9
  super().tap do |types|
10
10
  types[type][:limit] = new_limit
11
11
  end
@@ -13,9 +13,9 @@ class AttributeTest < ActiveSupport::TestCase
13
13
  end
14
14
  yield
15
15
  ensure
16
- ActiveRecord::Base.connection.class_eval do
16
+ ActiveRecord::Base.connection.singleton_class.class_eval do
17
17
  undef :native_database_types
18
- define_method :native_database_types do
18
+ define_method(:native_database_types) do
19
19
  super()
20
20
  end
21
21
  end
@@ -266,14 +266,14 @@ class AttributeTest < ActiveSupport::TestCase
266
266
  end
267
267
 
268
268
  test "limit should return nil for oddball column types that misuse the limit attribute" do
269
- create_model "Business", :location => :integer
270
- attribute = create_attribute(Business, "location")
271
- attribute.column.class_eval do
272
- define_method :limit do
269
+ create_model "Business", :location => :integer do
270
+ define_singleton_method :limit do
273
271
  # https://github.com/voormedia/rails-erd/issues/21
274
272
  { :srid => 4326, :type => "point", :geographic => true }
275
273
  end
276
274
  end
275
+
276
+ attribute = create_attribute(Business, "location")
277
277
  assert_nil attribute.limit
278
278
  end
279
279
 
@@ -306,13 +306,12 @@ class AttributeTest < ActiveSupport::TestCase
306
306
  end
307
307
 
308
308
  test "scale should return nil for oddball column types that misuse the scale attribute" do
309
- create_model "Kobold", :size => :integer
310
- attribute = create_attribute(Kobold, "size")
311
- attribute.column.class_eval do
309
+ create_model "Kobold", :size => :integer do
312
310
  define_method :scale do
313
311
  1..5
314
312
  end
315
313
  end
314
+ attribute = create_attribute(Kobold, "size")
316
315
  assert_nil attribute.scale
317
316
  end
318
317
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rolf Timmermans
8
8
  - Kerri Miller
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-14 00:00:00.000000000 Z
12
+ date: 2021-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -147,7 +147,7 @@ homepage: https://github.com/voormedia/rails-erd
147
147
  licenses:
148
148
  - MIT
149
149
  metadata: {}
150
- post_install_message:
150
+ post_install_message:
151
151
  rdoc_options: []
152
152
  require_paths:
153
153
  - lib
@@ -162,9 +162,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.7.9
167
- signing_key:
165
+ rubyforge_project:
166
+ rubygems_version: 2.6.14
167
+ signing_key:
168
168
  specification_version: 4
169
169
  summary: Entity-relationship diagram for your Rails models.
170
170
  test_files: