Module: Spreadhead::Page::Validations

Defined in:
lib/spreadhead/page.rb

Class Method Summary collapse

Class Method Details

.included(model) ⇒ Object

Hook for validations.

:title must be present and unique :text must be present :url must be unique



34
35
36
37
38
39
40
41
42
# File 'lib/spreadhead/page.rb', line 34

def self.included(model)
  model.class_eval do
    validates_presence_of :text
    validates_presence_of :title
    validates_uniqueness_of :title
    validates_uniqueness_of :url  
    validates_presence_of :url  
  end
end