Displaying 1 result from an estimated 1 matches for "sanitize_input".
2006 May 02
4
useful bit of code (hopefully)
Hi,
I often find myself using bits of code like this inside ActiveRecord,
perhaps it''s useful for others, or others can improve on it:
###########
# fix user input before validating it
before_validation :sanitize_input
# santize input before actual validation is called
# this uses the little methods defined below
def sanitize_input
trim %w(adres postcode woonplaats email naam telefoon mobiel)
downcase :email
empty_to_nil %w(telefoon mobiel)
end
# pass in a list of fields whose values will be conv...