Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 如何覆盖mailboxer-mailer_Ruby On Rails 4_Mailboxer - Fatal编程技术网

Ruby on rails 4 如何覆盖mailboxer-mailer

Ruby on rails 4 如何覆盖mailboxer-mailer,ruby-on-rails-4,mailboxer,Ruby On Rails 4,Mailboxer,为了使用Mandrill API,我已经在我的mailers文件夹中自定义了notification_mailer.rb,但是mailboxer忽略了它并继续使用常规smtp方法。我对Deviate也做了同样的事情,但Deviate在其初始值设定项文件管理器中有一个config.mailer。不是邮递员 下面是邮件文件。谢谢你的指点 class Mailboxer::NotificationMailer < Mailboxer::BaseMailer #Sends and email fo

为了使用Mandrill API,我已经在我的mailers文件夹中自定义了notification_mailer.rb,但是mailboxer忽略了它并继续使用常规smtp方法。我对Deviate也做了同样的事情,但Deviate在其初始值设定项文件管理器中有一个config.mailer。不是邮递员

下面是邮件文件。谢谢你的指点

class Mailboxer::NotificationMailer < Mailboxer::BaseMailer
#Sends and email for indicating a new notification to a receiver.
#It calls new_notification_email.

def mandrill_client
  require 'mandrill'
  @mandrill_client ||= Mandrill::API.new ENV['MANDRILL_APIKEY']
end


def send_email(notification, receiver)
  new_notification_email(notification, receiver)
end

#Sends an email for indicating a new message for the receiver
def new_notification_email(notification, receiver)
  @notification = notification
  @receiver     = receiver
  set_subject(notification)

  template_name = "new-notification-email-fr"
  template_content = []
  message = {
    to: [receiver.send(Mailboxer.email_method, notification)],
    subject: t('mailboxer.notification_mailer.subject', :subject => @subject),
    merge_vars: [
      {rcpt: receiver.send(Mailboxer.email_method, notification),
        vars: [
          ]
        }
      ]
    }
    mandrill_client.messages.send_template template_name, template_content, message
  end
end
class Mailboxer::NotificationMailer@subject),
合并变量:[
{rcpt:receiver.send(Mailboxer.email_方法,通知),
变量:[
]
}
]
}
mandrill_client.messages.send_模板模板名称、模板内容、消息
终止
终止

我使用了错误的命名约定。应该是的

class MailboxerNotificationMailer < Mailboxer::BaseMailer
class MailboxerNotificationMailer