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
Comment avez-vousComment localiser les messages d'erreur ActiveModel dans Rails 3?
- localisent message d'erreur (s) pour: pour prenom
- localisent message d'erreur (s): Last_Name
question similaire http://stackoverflow.com/questions/3501019/how-to-localize-the-active-record-error-messages – AMIT