こんにちは、
同一のステージング アプリケーションを使用して、Heroku で実行しているアプリがあります。environment/production.rb を environment/staging.rb にコピーしたことを除いて、2 つの間ですべてがまったく同じである必要があります。
環境変数も変更しました:
RACK_ENV=staging
RAILS_ENV=staging
電子メールは本番アプリでは期待どおりに送信されますが、ステージング アプリで電子メールを送信しようとすると、惨めに失敗します。
!ruby/ActiveRecord:Delayed::Backend::ActiveRecord::Job
attributes:
id: 6
priority: 0
attempts: 2
handler: |
--- !ruby/object:Delayed::PerformableMailer
args:
- 3
method_name: :admin_notification_signup
object: !ruby/class UserMailer
last_error: |-
{undefined method `index' for :email:Symbol
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/encodings.rb:117:in `value_decode'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/encodings.rb:101:in `decode_encode'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:64:in `do_decode'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:46:in `decoded'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:115:in `fold'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:96:in `wrapped_value'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:60:in `do_encode'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/fields/unstructured_field.rb:42:in `encoded'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/field.rb:133:in `method_missing'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/header.rb:190:in `block in encoded'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/header.rb:189:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/header.rb:189:in `encoded'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:1708:in `encoded'
/app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:433:in `set_payload_for_mail'
/app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:413:in `block in deliver_mail'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument'
/app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:412:in `deliver_mail'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/performable_mailer.rb:6:in `perform'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:94:in `block in invoke_job'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:91:in `invoke_job'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:178:in `block (2 levels) in run'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:178:in `block in run'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:177:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:234:in `block in reserve_and_run_one_job'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:234:in `reserve_and_run_one_job'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:162:in `block in work_off'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:161:in `times'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:161:in `work_off'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:133:in `block (4 levels) in start'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:132:in `block (3 levels) in start'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:129:in `block (2 levels) in start'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:128:in `loop'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:128:in `block in start'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/plugins/clear_locks.rb:7:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `block in add'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/worker.rb:127:in `start'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.2/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
run_at: 2012-06-02 20:49:55.976158 Z
locked_at:
failed_at:
locked_by:
queue:
created_at: 2012-06-02 20:49:31.768212 Z
updated_at: 2012-06-02 20:49:34.977784 Z
誰がこれを引き起こしているのか知っていますか? メールの事前スタイル設定に Roadie gem を使用しています。
user_mailer.rb:
class UserMailer < ActionMailer::Base
default :css => :email, from: "Admin <admin@mysite.com>"
host = ENV['HOST'].gsub(/http:\/\//, "")
default_url_options[:host] = host
......
構成:
config.action_mailer.delivery_method = :smtp
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => "587",
:domain => "gmail.com",
:user_name => ENV['EMAIL_USER'],
:password => ENV['EMAIL_PASS'],
:authentication => "plain",
:enable_starttls_auto => true
}