* Added validation for presence and length of name field when adding contexts and projects

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@8 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-01-16 15:35:24 +00:00
parent 49b8fa1007
commit 8428a4ade5
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,8 @@
class Context < ActiveRecord::Base
has_many :todo, :dependent => true
# Context name must not be empty
# and must be less than 255 bytes
validates_presence_of :name, :message => "context must have a name"
validates_length_of :name, :maximum => 255, :message => "context name must be less than %d"
end

View file

@ -1,3 +1,8 @@
class Project < ActiveRecord::Base
has_many :todo, :dependent => true
# Project name must not be empty
# and must be less than 255 bytes
validates_presence_of :name, :message => "project must have a name"
validates_length_of :name, :maximum => 255, :message => "project name must be less than %d"
end