5

मेरे पास एक 'उपयोगकर्ता' और 'प्रोफ़ाइल' मॉडल है। उपयोगकर्ता के प्रोफाइल के साथ एक से एक संबंध है और "accepts_nested_attributes_for प्रोफ़ाइल" है।कस्टम i18n त्रुटि संदेश देता है अवैधPluralization डेटा त्रुटि देता है?

मैं दो चेकबॉक्स के साथ प्रोफ़ाइल को मान्य कर रहा हूं - यह कहना है कि अनुबंधों में से एक को मान्य होने से पहले स्वीकार किया जाना चाहिए। तो मैं en.yml

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" 

आपको लगता है कि प्रोफ़ाइल दिखाई दे उपयोगकर्ता के तहत नीडिंत है में निम्नलिखित जोड़ा

वैसे भी, मैं किसी एक बॉक्स प्राप्त न करने के त्रुटि संदेश को अनुकूलित करना चाहते हैं - यह करने के लिए है

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 

मैं वास्तव में नहीं दिख रहा है क्या यह टी है: "प्रोफाइल" त्रुटि संदेश (as explained here).

यह मैं त्रुटि देता है के सामने रखा होना रुक बहुल करने के लिए rying, किसी भी मदद?

+0

हाँ मैं इसे उपयोग कर रहा हूँ एक शर्त के साथ:

कि यह कैसे मेरे ऐप है, जो बेशक है रेल से 3.

वैकल्पिक रूप से, उपयोगकर्ता के अंतर्गत प्रोफ़ाइल घोंसला बनाने से नहीं की कोशिश 2 रेल बल्कि में है जैसे। validates_acceptance_of: my_terms_and_conditions,: accept => true,: if =>: my_condition – digitalWestie

+0

'उपयोगकर्ता और प्रोफ़ाइल के बीच संबंध' क्या है ?? क्या आप 'फॉर्म व्यू स्निपेट' डाल सकते हैं? –

उत्तर

3

शायद यह

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

बजाय

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

होना चाहिए?

activerecord: 
    errors: 
    models: 
     profile: 
     attributes: 
      terms_and_conditions_a: 
      accepted: "You must accept the terms and conditions to continue" 
संबंधित मुद्दे