Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parent_mailer config option boot error #5663

Open
eneagoe opened this issue Dec 18, 2023 · 0 comments
Open

parent_mailer config option boot error #5663

eneagoe opened this issue Dec 18, 2023 · 0 comments

Comments

@eneagoe
Copy link

eneagoe commented Dec 18, 2023

Environment

  • Ruby 3.2.2
  • Rails 7.1.2
  • Devise 4.9.3

Current behavior

Setting up the parent_mailer options with

config.parent_mailer = "ApplicationMailer"

prevents the application from starting up - there's a class loading issue, apparently:

=> Booting Puma
=> Rails 7.1.2 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
~/.rvm/gems/ruby-3.2.2@webapp/gems/activesupport-7.1.2/lib/active_support/inflector/methods.rb:290:in `constantize': uninitialized constant ApplicationMailer (NameError)

      Object.const_get(camel_cased_word)
            ^^^^^^^^^^
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/activesupport-7.1.2/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/devise-4.9.3/app/mailers/devise/mailer.rb:4:in `<main>'
	from <internal:~/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:~/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
	from ~/webapp/config/initializers/devise_mailers.rb:1:in `<main>'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/engine.rb:683:in `load'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/engine.rb:683:in `block in load_config_initializer'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/activesupport-7.1.2/lib/active_support/notifications.rb:208:in `instrument'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/engine.rb:682:in `load_config_initializer'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/engine.rb:636:in `block (2 levels) in <class:Engine>'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/engine.rb:635:in `each'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/engine.rb:635:in `block in <class:Engine>'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/initializable.rb:32:in `instance_exec'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/initializable.rb:32:in `run'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/initializable.rb:61:in `block in run_initializers'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/initializable.rb:50:in `each'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/initializable.rb:50:in `tsort_each_child'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:415:in `call'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `each'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `call'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
	from ~/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/initializable.rb:60:in `run_initializers'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/application.rb:423:in `initialize!'
	from ~/webapp/config/environment.rb:5:in `<main>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rack-3.0.8/lib/rack/builder.rb:103:in `eval'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rack-3.0.8/lib/rack/builder.rb:103:in `new_from_string'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rack-3.0.8/lib/rack/builder.rb:94:in `load_file'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rack-3.0.8/lib/rack/builder.rb:64:in `parse_file'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rackup-2.1.0/lib/rackup/server.rb:354:in `build_app_and_options_from_config'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rackup-2.1.0/lib/rackup/server.rb:263:in `app'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/rackup-2.1.0/lib/rackup/server.rb:424:in `wrapped_app'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:36:in `start'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:145:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:136:in `perform'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/command/base.rb:178:in `invoke_command'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/command/base.rb:73:in `perform'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/command.rb:71:in `block in invoke'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/command.rb:149:in `with_argv'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/command.rb:69:in `invoke'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/railties-7.1.2/lib/rails/commands.rb:18:in `<main>'
	from <internal:~/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:~/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from ~/.rvm/gems/ruby-3.2.2@webapp/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:6:in `<main>'

Trying to get around this issue by defining the class in config/initializers/devise.rb with something like

class ApplicationMailer < ActionMailer::Base
end

will start the app correctly, but it won't work as expected - none of the before actions defined in app/mailers/application_mailer.rb will apply.

Expected behavior

Setting up parent_mailer should at the very least not crash the booting process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant