看板 Ruby 關於我們 聯絡資訊
感謝各方大德先進的幫忙協助 在參考了 janyfor 和 ericyu 兩位大大的提示之後 終於搞懂了啦 原來很簡單丫....就是在 model 裡加上 def validate errors.add(:name,'名字裡不能有笨字哦!!' ) if name.index('笨') != nil end 沒想到那麼簡單的東西卻研究那麼久...真是昏倒....感謝感謝丫^^ 不過小妹現在又有另一個問題啦.. 他秀出來的訊息是英文的...例如: 1 error prohibited this record from being saved There were problems with the following fields: ‧Name 名字裡不能有笨字哦!! 請問...英文的部份要怎麼改成中文呢?? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.231.124.68
poga:GetText或 Gxxxxxxxxxxxxxn 找找看這種多語系的外掛 08/28 20:19
godfat:原來原本沒加喔 O_o 08/28 20:35
godfat:竄改 ActionView::Helpers::ActiveRecordHelper:: 08/28 21:04
godfat: error_messages_for 08/28 21:05
janyfor:model 很好用喔 @@ 08/28 23:39