How can I add validation for a date with format mm/dd/yyyy inside model rails 4 ?
So, I only want a date with the format mm/dd/yyyy created inside model.
How do I do that?
validates_format_of :date_of_birth, :with => /\d{2}\/\d{2}\/\d{4}/, :message => "^Date must be in the following format: mm/dd/yyyy"
这是另一种方法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.