1.在 your_app/vendor/plugins下建立一个新的文件夹“new_errors”

2.在新建的文件夹“new_errors”下建一个“lib”的文件夹。
最后如下:
your_app/vendor/plugins/new_errors/lib

3.在“new_errors”下建立一个init.rb“文件,内容为:
require "new_errors"

4.在”lib“下新增一个叫”new_errors.rb“的文件。
内容如下:

module ActiveRecord
 class Errors
   @@default_error_messages = {
       :inclusion => "在列表中没有包含",
       :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 => "已经存在了",
       :not_a_number => "is not a number。Numbers ars things like 12345 ok?"
     }
 end
end

在这里面你就可以修改错误提示信息了。

当重新启动WEBRick的时候,plugs将自动被装入。