Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2683cf0

Browse files
committed
silence deprecation warning from the rename ofModule#parent toModule#module_parent
Rails 6 deprecated `Module#parent` and friends inrails/rails#34051, replacing them with a `module_*`-prefix naming scheme. This checks to see if `module_parent` is defined, using it if it's available.
1 parent0fbb1cd commit2683cf0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎lib/rails_erd/domain.rb‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ def initialize(models = [], options = {})
4949
# Returns the domain model name, which is the name of your Rails
5050
# application or +nil+ outside of Rails.
5151
defname
52-
defined?RailsandRails.applicationandRails.application.class.parent.name
52+
returnunlessdefined?(Rails) &&Rails.application
53+
54+
ifRails.application.class.respond_to?(:module_parent)
55+
Rails.application.class.module_parent.name
56+
else
57+
Rails.application.class.parent.name
58+
end
5359
end
5460

5561
# Returns all entities of your domain model.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp