ensl.org/app/models/custom_url.rb

9 lines
210 B
Ruby

class CustomUrl < ActiveRecord::Base
belongs_to :article
attr_accessible :name
validates :name,
length: {in: 2..10},
uniqueness: true,
format: /\A[a-z\-]{2,10}\Z/
end