1.thx for the help
2. what the heck is "humanized_attribute" ??
3. yeah, i'm doing some validation in the Order model, here is the
code, regarding validation :
PAYMENT_TYPES = [
#Displayed stored in db
["Cash" , "cash"],
["Check" , "check"],
["Credit card" , "credit card"]
]
ORDER_STATUS_TYPES = [
#Displayed stored in db
["Not shipped" , "not shipped"],
["Shipped" , "shipped"]
]
validates_presence_of :name, :surname, :adress, :telephone, :email, :pay_type
validates_format_of :name, :with => /[a-zA-Z]{2,50}/i
validates_format_of :surname, :with => /[a-zA-Z]{2,50}/i
validates_format_of :adress, :with => /^[a-zA-
Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\.
\,\-\/\']+[a-zA-
Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\.
\,\-\/\' ]+$/i
validates_format_of :telephone, :with => /(?!:\A|\s)(?!(\d{1,6}\s+
\D)|((\d{1,2}\s+){2,2}))(((\+\d{1,3})|(\(\+\d{1,3}\)))\s*)?((\d{1,6})|
(\(\d{1,6}\)))\/?(([ -.]?)\d{1,5}){1,5}((\s*(#|x|(ext))\.?\s*)\d{1,5})?
(?!:(\Z|\w|\b\s))/i
validates_length_of :email, :within => 2..128,
:message => "is not in the range of 2..128
characters."
validates_uniqueness_of :email, :message => "This email is already
taken.Please supply a new one"
validates_format_of :email, :with => /\A([\w\.\-\+\_]+)@((?:[-a-
z0-9]+\.)+[a-z]{2,})\z/i,
:message => "This is not a valid email
adress.Please renter email"
#validate_with EmailValidator /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]
{2,})$/i
validates_inclusion_of :pay_type, :in => PAYMENT_TYPES.map{|disp,
value> value}