Module: Gastropod::ActiveRecord::Validations
- Defined in:
- lib/gastropod/active_record/validations.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/gastropod/active_record/validations.rb', line 4 def self.included(base) base.validates :slug, :uniqueness => true base.validates :slug, :format => { :with => /\A[a-z0-9-]+\z/, :allow_blank => true } base.validates :slug, :presence => true base.before_validation :assign_generated_slug, :if => :generate_slug? end |