Add validation for item.name, only allow [a-zA-z-_]
This commit is contained in:
1 parent
ce63c53605
commit
12de9d2514
2 files changed
+2
-1
No files matched your search
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user