rubyonjets / jets

Ruby on Jets
http://rubyonjets.com
MIT License
2.6k stars 181 forks source link

Freshly generated --mode job app fails to send mails, missing ApplicationHelper #525

Closed tyler-wel closed 11 months ago

tyler-wel commented 3 years ago

Checklist

My Environment

Software Version
Operating System macOS Catalina 10.15.7
Jets 2.3.18
Ruby 2.7.0

Expected Behaviour

After generating a new project via --mode job, be able to then generate a mailer and send the mail via the console

Current Behavior

ApplicationHelper is not created with --mode job and therefor creates an error when attempting to send a mail. See the error log below for more info.

Step-by-step reproduction instructions

jets new mail_test --database=postgresql --mode job jets generate mailer TestMailer test_mail jets c TestMailer::test_mail.deliver_now

Error Log ``` irb(main):006:0> TestMailer::test_mail.deliver_now D, [2021-01-18T16:02:30.892923 #75972] DEBUG -- : TestMailer#test_mail: processed outbound mail in 8.5ms Traceback (most recent call last): 16: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.1/lib/action_view/lookup_context.rb:258:in `block in initialize_details' 15: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.1/lib/action_view/lookup_context.rb:51:in `block in ' 14: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/jets-3.0.2/lib/jets/core_ext/kernel.rb:11:in `require' 13: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' 12: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' 11: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.1/lib/action_view/base.rb:12:in `' 10: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.1/lib/action_view/base.rb:141:in `' 9: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.1/lib/action_view/base.rb:279:in `' 8: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks' 7: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:51:in `each' 6: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks' 5: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook' 4: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control' 3: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook' 2: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval' 1: from /.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/jets-3.0.2/lib/jets/controller/rendering/rack_renderer.rb:220:in `block in setup!' NameError (uninitialized constant ApplicationHelper) Did you mean? ApplicationMailer ```

Code Sample

Nothing was changed from a freshly generated app.

Solution Suggestion

Generate the ApplicationHelper when generating with --mode job

tyler-wel commented 3 years ago

Changing to Ruby 2.5.8 fixed the issue

AlexeyDemidov commented 2 years ago

I have hit the same issue with the missing ApplicationHelper. Switching to Ruby 2.5.8 is not an option as it reached EOL. The proper solution is to generate app/helpers/application_helper.rb

tongueroo commented 11 months ago

Fixed in #674