diff options
| author | hukl <contact@smyck.org> | 2009-09-10 12:00:03 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-10 12:00:03 +0200 |
| commit | 8afffc09bcaa4d1c77f1ca575fd5978423631bff (patch) | |
| tree | cc9c4d8d402337903584d845f5f2df6afdc52ba1 /app/models/node.rb | |
| parent | f7ce8c245fde3f6202103ae614b181c0ba44ed93 (diff) | |
refactored the create method to actually produce meaningful error messages when something goes wrong. added tests for corner cases
Diffstat (limited to 'app/models/node.rb')
| -rw-r--r-- | app/models/node.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 | |||
| 16 | after_save :update_unique_names_of_children | 16 | after_save :update_unique_names_of_children |
| 17 | 17 | ||
| 18 | # Validations | 18 | # Validations |
| 19 | # validates_length_of :slug, :within => 3..40 | 19 | validates_length_of :slug, :within => 1..255 |
| 20 | validates_presence_of :slug | ||
| 20 | validates_uniqueness_of :slug, :scope => :parent_id | 21 | validates_uniqueness_of :slug, :scope => :parent_id |
| 21 | 22 | ||
| 22 | # Index for Fulltext Search | 23 | # Index for Fulltext Search |
