내가 혼동을 넘어 해요 :이 거의 복사가/RoR에 액션 메일러 가이드에서 붙여이며, 아직 구문 오류가 발생합니다 :신비한 루비 구문 오류
class Contact < ActionMailer::Base
def contact a_name, a_company, a_phone, a_email, a_comments
subject "Contact request from #{name}"
recipients "[email protected]"
from "[email protected]"
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, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...{ :name => a_name, :company => a_company, :phone => a_phone,...^app/models/contact.rb:9: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...ompany => a_company, :phone => a_phone, :email => a_email, :...^app/models/contact.rb:9: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ..., :phone => a_phone, :email => a_email, :comments => a_comme...^app/models/contact.rb:9: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...email => a_email, :comments => a_comments, }^
어떤 아이디어가 있습니까? 나는 내가 여기서 잘못하고있는 것을 알아낼 수 없다.
람다와 혼동하지 않고 블록입니다. – Phrogz