Add validation for item.name, only allow [a-zA-z-_]

This commit is contained in:
Wen-Tien Chang committed 2010-01-28 17:30:35 +08:00
1 parent ce63c53605
commit 12de9d2514
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -14,6 +14,7 @@ class Item
key :position, Integer, :required => true
key :is_published, Boolean, :required => true, :default => true, :index => true
validates_format_of :name, :with => /^[a-zA-Z-_]+$/
belongs_to :parent, :class_name => "Item", :foreign_key => :parent_id
many :children, :class_name => "Item", :foreign_key => :parent_id