PDA

View Full Version : ExtJs?Rails????Validation??????????????????



masayuki_yamaoka
27 Jul 2010, 7:17 AM
//??????????????????Rails?????????????????????
//????????????? m(_'_)m
//-----------------------------------------------------------------------

ExtJs?Rails??????Web?????????????????
???????????Validation?????????????????????

Rails????scaffold?????????????Validation???????????
????????????????????
??? ?????i18n???????????????????????????
[config/locales/ja.yml]
activerecord:
errors:
???...
messages:
????....
empty: "??????????"
blank: "??????????"
????...
[config/locales/translation_ja.yml]
ja:
activerecord:
models:
user: "????"
attributes:
user:
name: "??"
???...
???scaffold??????????????????
????Validation????????????????????????
ext_scaffold???????????????????????????
?Field??????????
?????????????????translation_ja.yml?????????
????????

???????????ext_to_jason?????????????????????
???????????????????????????????????????
???????
????????????????????

ext_scafflold??????????
?????????????
????????????????????????????
?????????????

masayuki_yamaoka
2 Sep 2010, 7:49 PM
??RES???

?????????????????????????????RES????????

ext_scafflod?ext_to_jason???
<???????????>\vendor\plugins\ext_scaffold\lib\ext_scaffold_core_extensions\active_record\base.rb
??????
?????
??result[field_key] ||= 'Field ' + Array(errors[error.first]).join(' and ')

???????????'Field'?????????????
?????????I18n???????
?s = I18n.t "activerecord.attributes.#{self.class.to_s.demodulize.underscore}.#{error.first}"
?result[field_key] ||= s + Array(errors[error.first]).join(' and ')

????translation_ja.yml??????????????????????

??????????????????????????