c) however, we must normalize it only if it is an acceptable credit card... (else we would be accepting any assortment of digits and spaces).
At first I thought it would not matter if we normalized an unacceptable card, and then I remembered that often we fill in the form with what the user entered, and it would be strange if the format changed. So I agree, the format should not be normalized unless it is an acceptable credit card. So we use before_validation, we start with our own format validation with a regular expression. If everything is ok, we normalize the data, otherwise we let it be and the validation will fail in format validation. So just use before_validation and not use before_create or before_save at all. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ruby-on-rails-programming-with-passion" group. To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en -~----------~----~----~----~------~----~------~--~---
