mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
* 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:
parent
49b8fa1007
commit
8428a4ade5
2 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue