我超乎困惑:这几乎是一个RoR操作邮件程序指南的复制/粘贴,但它会引发语法错误:
class Contact < ActionMailer::Base def contact a_name,a_company,a_phone,a_email,a_comments subject "Contact request from #{name}" recipients "some@address.com" from "some_other@address.com" sent_on Time.now body { :name => a_name,:company => a_company,:phone => a_phone,:email => a_email,:comments => a_comments } end end
错误是:
app/models/contact.rb:9: Syntax error,unexpected tASSOC,expecting '}' body { :name => a_name,:company => a_company... ^ app/models/contact.rb:9: Syntax error,expecting tCOLON2 or '[' or '.' ...{ :name => a_name,... ^ app/models/contact.rb:9: Syntax error,expecting tCOLON2 or '[' or '.' ...ompany => a_company,:... ^ app/models/contact.rb:9: Syntax error,expecting tCOLON2 or '[' or '.' ...,:comments => a_comme... ^ app/models/contact.rb:9: Syntax error,expecting tCOLON2 or '[' or '.' ...email => a_email,:comments => a_comments,} ^
有任何想法吗?我不知道我在这里做错了什么