3

I’m trying to setup MailyHerald with devise gem in a rails 4 app. I followed these steps: https://github.com/Sology/maily_herald/wiki/Setup-with-'devise'-gem

Now, when I try to register a new user (a confirmation mail should be sent via MailyHerald) I get this error:

NoMethodError at /user
undefined method `[]' for false:FalseClass

maily_herald (0.9.3) lib/maily_herald.rb

# Gets the Maily logger.
def logger
  unless MailyHerald::Logging.initialized?
    opts = {
      level: options[:verbose] ? Logger::DEBUG : Logger::INFO,
    }
    opts[:target] = options[:logfile] if options[:logfile]
    MailyHerald::Logging.initialize(opts)
  end

Any idea? Thanks

EDIT: A small update, maybe related to the error I get:

when I do

maily_herald paperboy --start

as indicated in the page above, I get

undefined method `merge' for false:FalseClass

EDIT 2: Ok, I did some test.

I created a new app with devise from scratch (rails 4.2.5.1 and ruby 2.2.4p230). Now I get no error when a user registers, but no confirmation email is sent.

Running background processing

maily_herald paperboy --start

returns this

[Maily#cli] INFO: Started with options: {:mode=>:paperboy, :action=>:start, :daemon=>true}
You really should set a logfile if you're going to daemonize
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/gems/maily_herald-0.9.3/lib/maily_herald/cli.rb:200:in `daemonize'
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/gems/maily_herald-0.9.3/lib/maily_herald/cli.rb:45:in `paperboy'
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/gems/maily_herald-0.9.3/bin/maily_herald:10:in `<top (required)>'
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/bin/maily_herald:23:in `load'
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/bin/maily_herald:23:in `<main>'
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/bin/ruby_executable_hooks:15:in `eval'
/Users/fabbrro/.rvm/gems/ruby-2.2.4@testMailyHerald/bin/ruby_executable_hooks:15:in `<main>’

To further investigate, I'm also trying to setup the sample application. I created some entity (users) and tried to send them emails (via mailcatcher). Until now, even if devise gem is not installed, It seems I have no luck: no message at all when running background processing, no errors, but also no mail is sent. Did someone managed to successfully try the app ?

fabbrro
  • 125
  • 7
  • 1
    Did you restart your server after the set up? – svelandiag Feb 02 '16 at 14:57
  • Thank you for the reply, SsouLlesS. I restarted the server, but the error persists and no email is sent. – fabbrro Feb 02 '16 at 18:12
  • I tried to set up maily_herald with devise following the guide, and I also have the same issue, it seems to be a bug of maily_herald, I already oponed up an issue in github let's see if the maintainers take a look – svelandiag Feb 02 '16 at 18:34
  • Thanks for your help. I really appreciate it. I'll also follow the opened issue on github – fabbrro Feb 02 '16 at 18:51
  • @fabbrro - I had the same log message pop up into my version of maily_herald. So I decided to fork the gem and see what was going on underneath the hood. As it turns out, for some reason, the logfile I was specifying in my maily_herald.yml file was not being parsed in properly by the gem. What I did to fix it was fork the file. In the cli.rb file, the daemonize method was pulling in options["logfile"] instead of options[:logfile] .. so I just added this line: `options[:logfile] = options["logfile"]` Not elegant but it works ... – aldefouw Oct 04 '17 at 01:18

1 Answers1

2

I just noticed this question. Have You looked at my comment on github?

https://github.com/Sology/maily_herald/issues/17#issuecomment-182412069

Also, I checked my Procfile and I'm running:

web: bundle exec rails s
worker: bundle exec sidekiq -v
paperboy: bundle exec maily_herald paperboy

Sidekiq is essential for MailyHerald. I think it's not specified on Wiki page. let me know if this solves Your problem. I'll try also setup fresh app with Your setup. Any public repo I can look into?

UPDATE

Just created fresh app:

Then open mailcatcher and app in browser and sign up new user. You should see newly added mailing into dispatcher and sidekiq logs running this.

WRK
  • 311
  • 2
  • 6
  • Thanks to your help I finally found out what was the problem: following the github page, I created the file maily_herald.yml trying to configure maily_herald and I had left it empty. Once removed, I was able to solve the problem. Anyway, I accept your answer. It's thanks to the sample app you posted that I understand how to correctly setup and run mail_herald and I could compare the two apps to find the problem. It's true, how to setup Sidekiq via Procfile is not well specified on wiki page. I was not running it in the right way. Maily_herald seems to work correctly in my app now. Thanks! – fabbrro Feb 23 '16 at 18:54