1.在 your_app/vendor/plugins下建立一個(gè)新的文件夾“new_errors”

2.在新建的文件夾“new_errors”下建一個(gè)“l(fā)ib”的文件夾。
最后如下:
your_app/vendor/plugins/new_errors/lib

3.在“new_errors”下建立一個(gè)init.rb“文件,內(nèi)容為:
require "new_errors"

4.在”lib“下新增一個(gè)叫”new_errors.rb“的文件。
內(nèi)容如下:

module ActiveRecord
?class Errors
?? @@default_error_messages = {
?????? :inclusion => "在列表中沒(méi)有包含",
?????? :exclusion => "is reserved",
?????? :invalid => "is invalid",
?????? :confirmation => "doesn't match confirmation",
?????? :accepted? => "must be accepted",
?????? :empty => "can't be empty",
?????? :blank => "can't be blank",
?????? :too_long => "is too long (maximum is %d characters)",
?????? :too_short => "is too short (minimum is %d characters)",
?????? :wrong_length => "is the wrong length (should be %d characters)",
?????? :taken => "已經(jīng)存在了",
?????? :not_a_number => "is not a number。Numbers ars things like 12345 ok?"
???? }
?end
end

在這里面你就可以修改錯(cuò)誤提示信息了。

當(dāng)重新啟動(dòng)WEBRick的時(shí)候,plugs將自動(dòng)被裝入。

?