Created
November 1, 2010 20:35
-
-
Save ChristianPeters/658820 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHARACTER_LIMITS = { :description => 1000, :delivery_conditions_comment => 220, :terms_of_payment_comment => 200 } | |
validates_each CHARACTER_LIMITS.keys, :allow_nil => true do |record, attr, description| | |
record.errors.add attr, "zu lang (nicht mehr als #{CHARACTER_LIMITS[attr].to_s} Zeichen)." if attr_char_length(record[attr]) > CHARACTER_LIMITS[attr] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment