Skip to content

Commit b5337fa

Browse files
committed
Replace deprecated parent method with module_parent
1 parent d61f35b commit b5337fa

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

example_app_generator/generate_action_mailer_specs.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@
1414
end
1515
end
1616
CODE
17-
gsub_file 'config/initializers/action_mailer.rb',
18-
/ExampleApp/,
19-
Rails.application.class.parent.to_s
17+
18+
rails_parent =
19+
if Rails.version.to_f >= 6.0
20+
Rails.application.class.module_parent.to_s
21+
else
22+
Rails.application.class.parent.to_s
23+
end
24+
25+
gsub_file 'config/initializers/action_mailer.rb', /ExampleApp/, rails_parent
2026

2127
copy_file 'spec/support/default_preview_path'
2228
chmod 'spec/support/default_preview_path', 0755
23-
gsub_file 'spec/support/default_preview_path',
24-
/ExampleApp/,
25-
Rails.application.class.parent.to_s
29+
gsub_file 'spec/support/default_preview_path', /ExampleApp/, rails_parent
30+
2631
if skip_active_record?
2732
comment_lines 'spec/support/default_preview_path', /active_record/
2833
comment_lines 'spec/support/default_preview_path', /active_storage/

0 commit comments

Comments
 (0)