2017-06-27 8 views
0

私は検証エラーメッセージの属性名を変更するにはどうすればよいですか?

validates :agree_tos, acceptance: {accept: true, message: ->(object, data) {'Terms of Service must be accepted.'}}, allow_nil: false, on: :update 

を試みたが、それが受け入れられなければなりません

は、サービスのTOS利用規約に同意言います。

Iも

validates :agree_tos, acceptance: {accept: true, message: 'Terms of Service'}, allow_nil: false, on: :update 

Guide

答えて

0

を試みた私は/config/locales/en.yml

en: 
    activerecord: 
    attributes: 
     user: 
     agree_tos: "Terms of Service" 

でそれを変更し

validates :agree_tos, acceptance: true, allow_nil: false, on: :update 
を使用サービスの

規約を生み出す

を受け入れなければなりません
関連する問題