class User
include ActiveModel::Validations
validates_presense_of :first_name
validates_length_of :last_name, :in => 3..20, :too_long => "pick a shorter last name", :too_short => "pick a longer last name"
attr_accessor :first_name, :last_name
end
你怎么
- 为 :first_name 本地化错误消息
- 本地化 :last_name 的错误消息