2014-03-31 30 views
0

我有錯誤消息一個奇怪的問題。這是我唯一的類了Virtus加載ActiveModel和驗證。 我在那裏有一些驗證。本地機器上的一切工作正常。但是,在服務器上,如「landing.form.error.title」自定義郵件都沒有找到。我從rails找到沒有找到正常密鑰的消息。自定義驗證消息沒有找到

en.landing.form.error.title 

有趣的部分是未定製的消息顯示正確,就像名稱一樣。我評論的自定義消息出來的名字,並顯示在正確的區域設置的標準validate_presence_of消息。

class FreeOrder 
    include Virtus.model 
    include ActiveModel::Validations 

    attribute :email, String 
    attribute :title, String 
    attribute :name, String 
    attribute :newsletter, Boolean 

    validates :email, :email => {:strict_mode => true, message: I18n.t('landing.form.error.email') } 

    validates_presence_of :newsletter, message: I18n.t('landing.form.error.newsletter') 
    #validates_presence_of :name, message: I18n.t('landing.form.error.name') 
    validates_presence_of :name 
    validates_presence_of :title, message: I18n.t('landing.form.error.title')  

end 

回答

0

好吧,我想通了,問題是,我沒有在application.rb中

指定一個默認的語言環境