私はレールのメーラーが初めてです。私はherokuにデプロイしましたが、メールは正常に送受信されています。問題は、どのメーラーもビューをレンダリングしていないことです。
いつもそうではありませんでした。その接続に不可欠なものを移動し、接続を切断したに違いありません。ビューをメーラーに再接続する方法を教えてください。
私は Rails 3.2 を使用しています。回答が必要な情報は次のとおりです。
招待モデルでは:
after_create do |invitation|
InvitationMailer.delay.invitation_email(self)
end
そしてメーラーでは:
class InvitationMailer < ActionMailer::Base
helper ActionView::Helpers::UrlHelper
default from: "noreply@lumeo.com"
def invitation_email(invite)
@invitation = invite
mail(to: invite.recipient_email,
subject: "Invitation",
:template_path => 'mailers/invitation_email')
end
end
そして最後に、ビューはビュー/メーラーにあります:
You are invited to join our beta!
<%= link_to 'Sign Up', signup_with_token_url(@invitation.token) %>
この行は正しくルーティングされ、過去にテストしたとおりに機能していますが、ビューが電子メールの本文に表示されなくなりました...
開発ログ:
Started POST "/invitations" for 127.0.0.1 at 2012-11-04 17:00:22 -0800
Processing by InvitationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"SwmmoRObXNI5PoXYhGFc4zsqLulSJ4iq0v9VbcRBJ3E=", "invitation"=>{"recipient_email"=>"brian@labyrinth.com"}, "commit"=>"Send Invite"}
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
(0.2ms) BEGIN
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'brian@labyrinth.com' LIMIT 1
(0.2ms) UPDATE "users" SET "invitation_limit" = 6, "updated_at" = '2012-11-05 01:00:22.236722' WHERE "users"."id" = 2
SQL (0.3ms) INSERT INTO "invitations" ("created_at", "recipient_email", "sender_id", "sent_at", "token", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["created_at", Mon, 05 Nov 2012 01:00:22 UTC +00:00], ["recipient_email", "brian@labyrinth.com"], ["sender_id", 2], ["sent_at", nil], ["token", "650e4773e64a1120355e5392ecfea2fefb47dabf"], ["updated_at", Mon, 05 Nov 2012 01:00:22 UTC +00:00]]
Sent mail to brian@labyrinth.com (917ms)
Date: Sun, 04 Nov 2012 17:00:22 -0800
From: noreply@lumeo.com
To: brian@labyrinth.com
Message-ID: <50970fa63e33c_6673fd1a1035ae061987@Retina.local.mail>
Subject: Invitation
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
(1.6ms) COMMIT
Redirected to http://localhost:3000/invitations
Completed 302 Found in 942ms (ActiveRecord: 3.3ms)
Started GET "/invitations" for 127.0.0.1 at 2012-11-04 17:00:23 -0800
Processing by InvitationsController#index as HTML
User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
Invitation Load (0.3ms) SELECT "invitations".* FROM "invitations"
Rendered invitations/index.html.erb within layouts/application (1.5ms)
Rendered layouts/_stylesheets.html.erb (4.7ms)
Image Load (0.5ms) SELECT "images".* FROM "images" WHERE "images"."parent_id" = 2 AND "images"."parent_type" = 'User' LIMIT 1
Role Load (0.4ms) SELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles"."id" = "assignments"."role_id" WHERE "assignments"."user_id" = 2
Rendered layouts/_header.html.erb (9.6ms)
Rendered layouts/_footer.html.erb (0.6ms)
Completed 200 OK in 31ms (Views: 26.4ms | ActiveRecord: 2.0ms)
Heroku ログ:
2012-11-05T01:09:21+00:00 app[web.2]: Started POST "/invitations" for 76.175.198.239 at 2012-11-05 01:09:21 +0000
2012-11-05T01:09:22+00:00 app[worker.1]: [Worker(host:4ba7555d-5659-4f95-a8fb-13326b458480 pid:2)] Starting job worker
2012-11-05T01:09:22+00:00 app[worker.1]: Starting the New Relic Agent.
2012-11-05T01:09:22+00:00 app[worker.1]: [Worker(host:4ba7555d-5659-4f95-a8fb-13326b458480 pid:2)] New Relic Ruby Agent Monitoring DJ worker host:4ba7555d-5659-4f95-a8fb-13326b458480 pid:2
2012-11-05T01:09:23+00:00 app[web.2]: Processing by InvitationsController#create as HTML
2012-11-05T01:09:23+00:00 app[web.2]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"Utls4PaX/7TkwyZkhZnkm3pf8llGoX/j5LskL+9rO40=", "invitation"=>{"recipient_email"=>"brian@labyrinthvisuals.com"}, "commit"=>"Send Invite"}
2012-11-05T01:09:23+00:00 app[web.2]: User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4528 LIMIT 1
2012-11-05T01:09:23+00:00 app[web.2]: (3.2ms) BEGIN
2012-11-05T01:09:23+00:00 app[web.2]: User Load (3.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'brian@labyrinthvisuals.com' LIMIT 1
2012-11-05T01:09:23+00:00 app[web.2]: (0.8ms) UPDATE "users" SET "invitation_limit" = 90, "updated_at" = '2012-11-05 01:09:21.797013' WHERE "users"."id" = 4528
2012-11-05T01:09:23+00:00 app[web.2]: SQL (1.6ms) INSERT INTO "invitations" ("created_at", "recipient_email", "sender_id", "sent_at", "token", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["created_at", Mon, 05 Nov 2012 01:09:21 UTC +00:00], ["recipient_email", "brian@labyrinthvisuals.com"], ["sender_id", 4528], ["sent_at", nil], ["token", "53e21931e3481036c9019f8245e518b5ce8343aa"], ["updated_at", Mon, 05 Nov 2012 01:09:21 UTC +00:00]]
2012-11-05T01:09:23+00:00 app[web.2]:
2012-11-05T01:09:23+00:00 app[web.2]: Sent mail to brian@labyrinthvisuals.com (886ms)
2012-11-05T01:09:23+00:00 app[web.2]: Date: Mon, 05 Nov 2012 01:09:22 +0000
2012-11-05T01:09:23+00:00 app[web.2]: From: noreply@lumeo.com
2012-11-05T01:09:23+00:00 app[web.2]: To: brian@labyrinthvisuals.com
2012-11-05T01:09:23+00:00 app[web.2]: Message-ID: <509711c25d54a_2fc899c84342@52b7b88c-4573-408e-8219-a12f9c4087fb.mail>
2012-11-05T01:09:23+00:00 app[web.2]: Subject: Invitation
2012-11-05T01:09:23+00:00 app[web.2]: Mime-Version: 1.0
2012-11-05T01:09:23+00:00 app[web.2]: Content-Type: text/plain;
2012-11-05T01:09:23+00:00 app[web.2]: charset=UTF-8
2012-11-05T01:09:23+00:00 app[web.2]: Content-Transfer-Encoding: 7bit
2012-11-05T01:09:23+00:00 app[web.2]:
2012-11-05T01:09:23+00:00 app[web.2]:
2012-11-05T01:09:23+00:00 heroku[router]: POST www.lumeo.com/invitations dyno=web.2 queue=0 wait=0ms service=1857ms status=302 bytes=98
2012-11-05T01:09:23+00:00 app[web.2]: (3.7ms) COMMIT
2012-11-05T01:09:23+00:00 app[web.2]: Redirected to http://www.lumeo.com/invitations
2012-11-05T01:09:23+00:00 app[web.2]: Completed 302 Found in 1543ms (ActiveRecord: 22.2ms)
2012-11-05T01:09:23+00:00 app[web.2]:
2012-11-05T01:09:23+00:00 app[web.2]:
2012-11-05T01:09:23+00:00 app[web.2]: Started GET "/invitations" for 76.175.198.239 at 2012-11-05 01:09:23 +0000
2012-11-05T01:09:24+00:00 heroku[router]: GET www.lumeo.com/invitations dyno=web.2 queue=0 wait=0ms service=727ms status=200 bytes=8052
2012-11-05T01:09:24+00:00 app[web.2]: Role Load (1.5ms) SELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles"."id" = "assignments"."role_id" WHERE "assignments"."user_id" = 4528
2012-11-05T01:09:24+00:00 app[web.2]: Rendered layouts/_header.html.erb (544.9ms)
2012-11-05T01:09:24+00:00 app[web.2]: User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4528 LIMIT 1
2012-11-05T01:09:24+00:00 app[web.2]: Invitation Load (2.3ms) SELECT "invitations".* FROM "invitations"
2012-11-05T01:09:24+00:00 app[web.2]: Processing by InvitationsController#index as HTML
2012-11-05T01:09:24+00:00 app[web.2]: Rendered invitations/index.html.erb within layouts/application (4.8ms)
2012-11-05T01:09:24+00:00 app[web.2]: Rendered layouts/_stylesheets.html.erb (0.8ms)
2012-11-05T01:09:24+00:00 app[web.2]: Image Load (1.6ms) SELECT "images".* FROM "images" WHERE "images"."parent_id" = 4528 AND "images"."parent_type" = 'User' LIMIT 1
2012-11-05T01:09:24+00:00 app[web.2]: Rendered layouts/_footer.html.erb (1.3ms)
2012-11-05T01:09:24+00:00 app[web.2]: Completed 200 OK in 708ms (Views: 664.3ms | ActiveRecord: 39.2ms)
2012-11-05T01:09:24+00:00 app[web.1]: => Booting Thin
2012-11-05T01:09:24+00:00 app[web.1]: => Rails 3.2.3 application starting in production on http://0.0.0.0:59079
2012-11-05T01:09:24+00:00 app[web.1]: => Call with -d to detach
2012-11-05T01:09:24+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-11-05T01:09:24+00:00 app[web.1]: ** [NewRelic][11/05/12 01:09:23 +0000 1a2f3028-d8e6-415a-889a-de99cac2c096 (2)] INFO : Dispatcher: thin
2012-11-05T01:09:24+00:00 app[web.1]: ** [NewRelic][11/05/12 01:09:23 +0000 1a2f3028-d8e6-415a-889a-de99cac2c096 (2)] INFO : Application: sharp-flower-5688
2012-11-05T01:09:24+00:00 app[web.1]: ** [NewRelic][11/05/12 01:09:23 +0000 1a2f3028-d8e6-415a-889a-de99cac2c096 (2)] INFO : New Relic Ruby Agent 3.4.1 Initialized: pid = 2
2012-11-05T01:09:24+00:00 app[web.1]: ** [NewRelic][11/05/12 01:09:24 +0000 1a2f3028-d8e6-415a-889a-de99cac2c096 (2)] INFO : NewRelic::Agent::Samplers::DelayedJobSampler sampler not available: No DJ worker present
2012-11-05T01:09:24+00:00 app[web.2]: Connected to NewRelic Service at collector-5.newrelic.com
2012-11-05T01:09:24+00:00 app[web.2]: ** [NewRelic][11/05/12 01:09:24 +0000 52b7b88c-4573-408e-8219-a12f9c4087fb (2)] INFO : Reporting performance data every 60 seconds.
助けてください。これらは、一般公開する前に行う必要がある最後の作業の一部です...明日...