未初始化的常量DeviseMailersController

时间:2017-02-24 01:20:36

标签: ruby-on-rails ruby devise

我正在使用devise gem并且之前创建了一个控制器DeviseMailersController,但之后用rails d controller DeviseMailers删除了它。当我尝试发送重置密码电子邮件时,我收到以下错误:

  NameError in Devise::PasswordsController#create
  uninitialized constant DeviseMailersController

  names.inject(Object) do |constant, name|
    if constant == Object
      constant.const_get(name)
    else
      candidate = constant.const_get(name)
      next candidate if constant.const_defined?(name, false)

我已将smtp设置放在application.rb文件中。

application.rb中

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module AssessmentWebApp
  class Application < Rails::Application
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
      address:              "smtp.gmail.com",
      port:                 587,
      enable_starttls_auto: true,
      user_name:            ENV["google_username"],
      password:             ENV["google_password"],
      authentication:       'plain'
    }
    config.active_record.raise_in_transactional_callbacks = true
  end
end

0 个答案:

没有答案