From 8afffc09bcaa4d1c77f1ca575fd5978423631bff Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 10 Sep 2009 12:00:03 +0200 Subject: refactored the create method to actually produce meaningful error messages when something goes wrong. added tests for corner cases --- app/models/node.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 057248e..fa9d519 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -16,7 +16,8 @@ class Node < ActiveRecord::Base after_save :update_unique_names_of_children # Validations - # validates_length_of :slug, :within => 3..40 + validates_length_of :slug, :within => 1..255 + validates_presence_of :slug validates_uniqueness_of :slug, :scope => :parent_id # Index for Fulltext Search -- cgit v1.3