ensl.org/app/models/custom_url.rb
2017-11-12 18:02:53 +01:00

12 lines
269 B
Ruby

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