Я пытаюсь настроить SendGrid на мое приложение Rails, я вслед за этим: http://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.htmlSendGrid и Rails Ошибка
До сих пор я установить мой config/environment.rb
ActionMailer::Base.smtp_settings = {
:user_name => *********,
:password => *********,
:domain => *********,
:address => "smtp.sendgrid.net",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
Сделано новый файл называется app/models/notifier.rb
, который содержит
class Notifier < ActionMailer::Base
include SendGrid
default :from => "*****@******.com"
# send a signup email to the user, pass in the user object that contains the user's email address
def signup_email(user)
mail(:to => user.email, :subject => "Thanks for signing up")
end
end
в консоли рельсы, это то, что происходит.
>> @new_user = User.new(:email => '[email protected]')
=> #<User id: nil, email: "[email protected]", created_at: nil, updated_at: nil>
>> @new_user.save
(0.2ms) BEGIN
SQL (1.0ms) INSERT INTO "users" ("created_at", "email", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["created_at", Tue, 23 Apr 2013 01:21:17 UTC +00:00], ["email", "[email protected]"], ["updated_at", Tue, 23 Apr 2013 01:21:17 UTC +00:00]]
(1.8ms) COMMIT
=> true
>> Notifier.signup_email @new_user
ActionView::MissingTemplate: Missing template notifier/signup_email with "mailer". Searched in:
* "notifier"
Что я делаю неправильно? Я не понимаю, зачем мне нужен шаблон. Я новичок в Rails, поэтому, пожалуйста, простите меня, если это очевидно.
Спасибо за помощь! Возможно, стоит отметить, что я продолжал получать ошибки шаблона, пока я не включил ': body =>« blah blah »в мой почтовый вызов. В противном случае он ищет шаблон для заполнения тела. –