final/app/models/blog_info.rb

6 lines
192 B
Ruby

class BlogInfo < ActiveRecord::Base
validates :name, length: {minimum: 2, maximum: 20}
validates :email, format: {with: /\A[a-zA-Z0-9\-]+@[a-zA-Z0-9-]+\.(org|com|cn|io|net|cc|me)\z/}
end