Please, Can some body guide me with this issue..?
I can't normalize the credit_card number,
my model code is:
validates_format_of :credit_card,
:with => /(\d{16})|(\d{4})[' '](\d{4})[' '](\d{4})['
'](\d{4})|(\d{4})[-](\d{4})[-](\d{4})[-](\d{4})/,
:on=> :create,
:message=>"Invalid number format"
#callback before update
before_save:normalize_number
private
def normalize_number
self.credit_card.delete' '
self.credit_card.delete'-'
end
Thanks in advance
Luis
--~--~---------~--~----~------------~-------~--~----~
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
ruby-on-rails-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---