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

NoMethodError error for generated mailers with latest padrino 0.15.0 version #2232

Closed
wikimatze opened this issue Oct 10, 2020 · 4 comments
Closed

Comments

@wikimatze
Copy link
Member

bug

What is the current behavior?

Create a new app:

padrino-gen project job-vacancy -d activerecord \                                     
  -t rspec \
  -s jquery \
  -e erb \
  -a sqlite

Next generate a mailer:

padrino-gen mailer Registration registration_email

And start the application:

bundle exec padrino s

will produce the following error:

 ERROR -  NoMethodError - undefined method `mailer' for JobVacancy::App:Class:
 /home/wm/Downloads/job-vacancy/app/mailers/registration.rb:42:in `<top (required)>'
Traceback (most recent call last):
	34: from /home/wm/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:24:in `<main>'
	33: from /home/wm/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:24:in `eval'
	32: from /home/wm/.rvm/gems/ruby-2.7.1/bin/padrino:23:in `<main>'
	31: from /home/wm/.rvm/gems/ruby-2.7.1/bin/padrino:23:in `load'
	30: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/bin/padrino:9:in `<top (required)>'
	29: from /home/wm/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	28: from /home/wm/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	27: from /home/wm/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	26: from /home/wm/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	25: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/cli/launcher.rb:30:in `start'
	24: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/cli/adapter.rb:9:in `start'
	23: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/server.rb:12:in `run!'
	22: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/server.rb:24:in `detect_application'
	21: from /home/wm/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
	20: from /home/wm/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
	19: from /home/wm/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
	18: from /home/wm/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
	17: from config.ru:9:in `block in <main>'
	16: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core.rb:74:in `application'
	15: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core.rb:74:in `each'
	14: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core.rb:74:in `block in application'
	13: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/mounter.rb:115:in `map_onto'
	12: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/application/application_setup.rb:39:in `setup_application!'
	11: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/application.rb:171:in `require_dependencies'
	10: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/loader.rb:152:in `require_dependencies'
	 9: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/loader.rb:152:in `each'
	 8: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/loader.rb:154:in `block in require_dependencies'
	 7: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/reloader.rb:96:in `safe_load'
	 6: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/reloader.rb:309:in `with_silence'
	 5: from /home/wm/.rvm/gems/ruby-2.7.1/gems/padrino-core-0.15.0/lib/padrino-core/reloader.rb:96:in `block in safe_load'
	 4: from /home/wm/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
	 3: from /home/wm/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
	 2: from /home/wm/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
	 1: from /home/wm/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/home/wm/Downloads/job-vacancy/app/mailers/registration.rb:42:in `<top (required)>': undefined method `mailer' for JobVacancy::App:Class (NoMethodError)

What is the expected behavior?

That mailers are registered in the normal sinatra way.

Which versions of Ruby, Padrino, Sinatra, Rack, OS are you using? Did this work in previous versions?

Ruby: 2.7.1
OS: xubuntu 18.04
Padrino: 0.15.0

@aldentea
Copy link

I found this error is caused by sinatra/sinatra#1214 (so, you can avoid the error with Sinatra 2.0.x), especially the change of lib/sinatra/base.rb, which prevents Padrino::Mailer::Helpers::ClassMethods from being included.
At the moment I have no idea with how the change affects or how to realize the expected behavior.

@wikimatze
Copy link
Member Author

@aldentea thanks for pointing out at this line. Puh, bug is very old in Sinatra and merged only now.

I will still do my debugging session and see how I can find the same place with vim :). The bad thing is, that we don't have any integration test for commands and starting the app.

When we fix this issue, we need a new version of Padrino.

@olleolleolle
Copy link
Contributor

This issue happens in the test suite of this repo, as well. This is from the latest master:

https://travis-ci.org/github/padrino/padrino-framework/jobs/750293693

`<class:SinatraApp>': undefined method `mailer' for SinatraApp:Class (NoMethodError)

rake aborted!

@jkowens
Copy link
Collaborator

jkowens commented Dec 17, 2022

@nesquena I believe this can be closed, the breaking change in Sinatra was reverted.

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

No branches or pull requests

5 participants