1
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
你怎麼了如何在Rails 3中本地化ActiveModel錯誤消息?
- 本地化的錯誤消息(S):用於FIRST_NAME
- 本地化的錯誤消息(S):姓氏
類似問題http://stackoverflow.com/questions/3501019/how-to-localize-the-active-record-error-messages – AMIT 2010-10-05 19:03:31