Skip to content

Commit 47dad08

Browse files
committed
allow parent_name to be used in older ActiveSupport versions
1 parent 0ca476a commit 47dad08

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/promptify/railtie.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ def show_pretty_prompt
2222
end
2323

2424
def app_name
25-
Rails.application.class.parent_module_name.underscore.dasherize
25+
# ActiveSupport's `Module#parent_name` is deprecated in 6.1+.
26+
if Rails.application.respond_to?(:parent_module_name)
27+
Rails.application.class.parent_module_name.underscore.dasherize
28+
else
29+
Rails.application.class.parent_name.underscore.dasherize
30+
end
2631
end
2732

2833
def heroku_app

0 commit comments

Comments
 (0)