나는 Roku 3.1에서 Heroku에서 내 앱을 가지고 있습니다. 전자 메일을 보내기 위해 ActionMailer를 설정하면 Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
오류가 발생합니다.스케줄러 (CRON)를 사용하여 Heroku에서 메일 보내기
before_filter :mailer_set_url_options
def mailer_set_url_options
ActionMailer::Base.default_url_options[:host] = request.host_with_port
end
그것은 잘 작동 :
나는 그것을 이런 식으로 (와 ApplicationController)를 고정. 하지만 지금은 자정에 매일 몇 전자 메일을 보낼 필요가있다, 그래서 나는 scheduler.rake에서 작업에이 줄을 넣어 :Mailer.notif_invoice(@inv_user, @invoice.id).deliver
그리고이 오류가있어 :
`Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true`
을
이 오류는 잠시 후에 Scheduler
으로 전자 메일을 보내려는 경우에만 발생합니다.
팁을 주면 고칠 수 있습니까?
나는 나의 작업에이 라인을 추가하려고 :ActionMailer::Base.default_url_options[:host] = request.host_with_port
하지만 난 당신의 코드가 작동하지 않는 이유는 사실 그 아래라고 생각
rake aborted!
undefined local variable or method `request' for main:Object