我試圖從升級軌應用2.3到3.0.6軌道3升級 - 您使用的是舊的API在郵件類
其在軌道下面的代碼2.3
class MessageSender < ActionMailer::Base
def send_message(subject,to,from,body,respondent = nil, content_type = 'text/plain')
@content_type = content_type
@subject = subject
@recipients = to
@from = from
# @sent_on = Time.now
@body = {:body_text => body}
end
end
在升級過程的代碼被通過參照該著名blog有關在使用的ActionMailer改性如下面
class MessageSender < ActionMailer::Base
def send_message(subjet,to,from,body,respondent = nil,content_type='text/plain')
mail(:to => to, :subject => subject, :from => from, :body => body, :content_type => content_type)
end
end
軌3.0
最後跑rake rails:upgrade:check
(檢查導軌3個不兼容的功能),它顯示
Old ActionMailer class API
You're using the old API in a mailer class.
More information: http://lindsaar.net/2010/1/26/new-actionmailer-api
The culprits:
- app/models/message_sender.rb
(IE)它說我還在使用舊API
有人可以解釋我失去了什麼這裏 ?
還有沒有其他方法可以消除「您在郵件類中使用舊API」錯誤?
FYI:寶石被更新和環境是紅寶石1.8.7,軌3.0.6
也許這是因爲你有'app/models'中的郵件程序而不是'app/mailers'? – Lucas 2013-05-01 06:14:38
@Lucas試圖將它移入'app/mailers',但結果相同 – shiva 2013-05-01 06:34:09