ruby で次のクラス定義があるとします。
class Conversation
class Message
include ActiveModel::Validations
attr_accessor :quantity
validates :quantity, :presence => true
end
end
どのように i18n を使用してエラー メッセージをカスタマイズできますか。たとえば、クラス Conversation の正しいルックアップは次のようになります。
activemodel:
errors:
models:
conversation:
attributes:
quantity:
blank: "Some custom message"
しかし、Message クラスの場合はどうでしょうか。私は試した:
activemodel:
errors:
models:
conversation:
message:
attributes:
quantity:
blank: "Some custom message"
activemodel:
errors:
models:
message:
attributes:
quantity:
blank: "Some custom message"
activemodel:
errors:
models:
conversation::message:
attributes:
quantity:
blank: "Some custom message"
それらのどれも機能しません アイデアはありますか、それとも ActiveModel または I18n のバグですか?