我正在使用Rails 3測試用例。在寫情況下,我得到了棄用錯誤,如rails 3測試用例error.on(:field)vs。錯誤[:field]
DEPRECATION WARNING: Errors#on have been deprecated, use Errors#[] instead.
Also note that the behaviour of Errors#[] has changed. Errors#[] now always returns an Array. An empty Array is returned when there are no errors on the specified attribute. (called from on at /usr/local/lib/ruby/gems/1.9.1/gems/activemodel-3.0.0.rc/lib/active_model/deprecated_error_methods.rb:7)
對於我使用的錯誤[:現場]代替errors.on(:場) 現在棄用錯誤消失,但情況並不像早期的工作是工作。這不是模型
測試任何驗證索爾
什麼是你的問題? – shingara 2010-10-23 11:09:09
問題是errors.on(:field)在rails單元測試中顯示deprecation錯誤和錯誤[:field]無法正常工作..有沒有什麼辦法可以解決這個問題。 – 2010-10-23 11:26:53