Closed Frexuz closed 7 years ago
hi @Frexuz, did you restart the server after the installation?
Yes
Weird, I'm actually using it in 4 Rails (v4, v5) apps with no problems. Is it this app open source? Or could you push some code that reproduces the error? I'd take a look. Thanks.
I tried in a new app. /maily
works fine. So its something with my app. However, the install command is a bit broken.
Running this on a 100% new app, after adding the gem.
➜ maily-test git:(master) ✗ rails g maily:install
Running via Spring preloader in process 7903
route mount Maily::Engine, at: 'maily'
create config/initializers/maily.rb
/Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/lib/maily.rb:32:in `join': no implicit conversion of nil into String (TypeError)
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/lib/maily.rb:32:in `load_emails_and_hooks'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/lib/maily/mailer.rb:14:in `all'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/lib/generators/maily/install_generator.rb:27:in `build_hooks'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/lib/generators/maily/install_generator.rb:10:in `install'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `each'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `map'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/group.rb:232:in `dispatch'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/generators.rb:269:in `invoke'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/commands/generate/generate_command.rb:24:in `perform'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/command/base.rb:63:in `perform'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/command.rb:44:in `invoke'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
from /Users/kristiangerardsson/www/maily-test/bin/rails:9:in `<top (required)>'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:286:in `load'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:286:in `block in load'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:286:in `load'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
➜ maily-test git:(master) ✗ rails g maily:install
Running via Spring preloader in process 8324
route mount Maily::Engine, at: 'maily'
identical config/initializers/maily.rb
create lib/maily_hooks.rb
Re-running the command makes it pass.
My application does
Processing by Maily::EmailsController#index as HTML
Rendering /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/app/views/maily/emails/index.html.erb within layouts/application
vs (a clean repo with maily)
Processing by Maily::EmailsController#index as HTML
Rendering /Users/kristiangerardsson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/maily-0.6.0/app/views/maily/emails/index.html.erb within layouts/maily/application
so, it's rendering layouts/application
vs layouts/maily/application
any further ideas?
Vendored the gem into the app's local /vendor and loaded the gem from there
changed class EmailsController < ApplicationController
to class EmailsController < Maily::ApplicationController
and that worked.
Somehow my ApplicationController loaded, and not the gem's. Not sure that is a correct solution tho. What you think?
Hi @Frexuz about the error with rails g maily:install
on first run, it was fixed here:
https://github.com/markets/maily/pull/17 (this commit => https://github.com/markets/maily/pull/17/commits/bf6ec1665219e00f431b42a6ebce24a9b9450934)
So if you change to use 0.6.1, this is fixed.
About the problem with Maily::ApplicationController
, I'm going to take look now and I'll ping you later. But yes, probably forcing that namespace will solve the issue.
Thanks for all this info!
Not sure what I'm doing wrong.
Seems it tried to render the apps normal layout. Just browsing
localhost:3000/maily
I just used the generator to install the config and hooks file, and haven't changed them.
Any ideas?