Skip to content

Commit

Permalink
Replace deprecated parent method with module_parent
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Dec 11, 2020
1 parent d61f35b commit b5337fa
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions example_app_generator/generate_action_mailer_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
end
end
CODE
gsub_file 'config/initializers/action_mailer.rb',
/ExampleApp/,
Rails.application.class.parent.to_s

rails_parent =
if Rails.version.to_f >= 6.0
Rails.application.class.module_parent.to_s
else
Rails.application.class.parent.to_s
end

gsub_file 'config/initializers/action_mailer.rb', /ExampleApp/, rails_parent

copy_file 'spec/support/default_preview_path'
chmod 'spec/support/default_preview_path', 0755
gsub_file 'spec/support/default_preview_path',
/ExampleApp/,
Rails.application.class.parent.to_s
gsub_file 'spec/support/default_preview_path', /ExampleApp/, rails_parent

if skip_active_record?
comment_lines 'spec/support/default_preview_path', /active_record/
comment_lines 'spec/support/default_preview_path', /active_storage/
Expand Down

0 comments on commit b5337fa

Please sign in to comment.