SendGrid API'sini kullanmaya çalışırken Ruby 1.9.3 ve aşağıdaki satırı takip ederek aşağıdaki hatayı alıyorum.NoMethodError Ruby 1.9.3
NoMethodError (undefined method `to_h' for #<Hash:0x00000005da0958>):
KOD: [ "mailer.mail(mail_defaults)
" Aşağıda bu satırda]
HATA
varsayarak bazı kullanıcılar
recipients = []
recipient = SendGrid::Recipient.new('[email protected]')
recipient.add_substitution('name', 'Billy Bob')
recipient.add_substitution('number', 1234)
recipient.add_substitution('time', '10:30pm')
recipients << recipient
# then initialize a template
template = SendGrid::Template.new('blahblah7bef2-d25b00')
# create the client
# see client above
# set some defaults
mail_defaults = {
:from => '[email protected]',
:html => '<h1>I like email tests</h1>',
:text => 'I like email tests',
:subject =>'Test Email is great',
}
mailer = SendGrid::TemplateMailer.new(client, template, recipients)
# then mail the whole thing at once
mailer.mail(mail_defaults)
ben bunu denedim bu yüzden benim mail_defaults dizisi olabileceğini düşündüm (aşağıya bakınız) ve aynı satırda aynı hatayı aldık.
mail_defaults = {
from: '[email protected]',
html: '<h1>I like email tests</h1>',
text: 'I like email tests',
subject: 'Test Email is great',
}
benim kodunda bir hata varsa veya SendGrids mailer.mail yönteminde bir hata onların mı?
Bize tam geri izleme gösterebilir misiniz? Backtrace susturucularını 'config/initializers/backtrace_silencers.rb' içinde kaldırmanız gerekebilir. – BoraMa