Search code examples
ruby-on-railsdevisesidekiqmailing

MailyHerald setup with Devise gem (error: NoMethodError at /user)


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 ?


Solution

  • 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.