5

Bir 'kullanıcı' ve bir 'profil' modelim var. Kullanıcının profille birebir ilişkisi var ve "accepts_nested_attributes_for profile".Özel i18n hata iletisi atıyor InvalidPluralizationData hatası?

İki onay kutusuyla profili doğrulıyorum - yani anlaşmalardan birinin onaylanmadan önce kabul edilmesi gerekir.

Neyse, kutulardan birini kabul etmiyor için hata mesajı özelleştirmek isteyen yüzden O bu bilgileri paylaşan

activerecord: 
    attributes: 
    user: 
     profile: 
     terms_and_conditions_a: 
      accepted: "You must accept the terms and conditions to continue" 
     terms_and_conditions_b: 
      accepted: "You must accept the terms and conditions to continue" 

kullanıcıya altında yer alan en.yml aşağıdaki eklendi - Bu etmektir gerçekten t ne görmüyorum

I18n::InvalidPluralizationData 
translation data {:terms_and_conditions_a=>{:invalid=>"You must accept the terms and conditions to continue"}} can not be used with :count => 1 

: "Profil" hata iletisiyle (as explained here).

Bu bana hata veriyor önünde koymak durdurulur çoğullaşmak için yardım etmek, yardım etmek?

Belki
+0

Yep: Bu kuşkusuz olduğu 3.

Alternatif olarak, kullanıcı altındaki profili yuvalama çalışıyorum raylar yerine 2 raylar benim app, ne kadar

budur Örneğin. validates_acceptance_of: my_terms_and_conditions,: accept => true,: if =>: my_condition – digitalWestie

+0

Kullanıcı ve profil arasındaki ilişki nedir? Form görünümü snippet'ini koyabilir misiniz? –

cevap

3

o

activerecord: 
    errors: 
    models: 
     user: 
     profile: 
      attributes: 
      terms_and_conditions_a: 
       accepted: "You must accept the terms and conditions to continue" 

yerine

activerecord: 
    attributes: 
    user: 
     profile: 
     terms_and_conditions_a: 
      accepted: "You must accept the terms and conditions to continue" 

olmalıdır? Bir koşulu ile kullanıyorum

activerecord: 
    errors: 
    models: 
     profile: 
     attributes: 
      terms_and_conditions_a: 
      accepted: "You must accept the terms and conditions to continue"