Adding a lower and upper length on various web site varchar fields. Fixes one test.
This commit is contained in:
parent
25c3310be4
commit
a5e5cbc739
6 changed files with 12 additions and 2 deletions
|
@ -3,6 +3,8 @@ class DiaryEntry < ActiveRecord::Base
|
|||
has_many :diary_comments, :order => "id"
|
||||
|
||||
validates_presence_of :title, :body
|
||||
validates_length_of :title, :within => 1..255
|
||||
validates_length_of :language, :within => 2..3
|
||||
validates_numericality_of :latitude, :allow_nil => true
|
||||
validates_numericality_of :longitude, :allow_nil => true
|
||||
validates_associated :user
|
||||
|
|
|
@ -3,6 +3,7 @@ class Message < ActiveRecord::Base
|
|||
belongs_to :recipient, :class_name => "User", :foreign_key => :to_user_id
|
||||
|
||||
validates_presence_of :title, :body, :sent_on, :sender, :recipient
|
||||
validates_length_of :title, :within => 1..255
|
||||
validates_inclusion_of :message_read, :in => [ true, false ]
|
||||
validates_associated :sender, :recipient
|
||||
end
|
||||
|
|
|
@ -3,6 +3,8 @@ class Trace < ActiveRecord::Base
|
|||
|
||||
validates_presence_of :user_id, :name, :timestamp
|
||||
validates_presence_of :description, :on => :create
|
||||
validates_length_of :name, :within => 1..255
|
||||
validates_length_of :description, :within => 1..255
|
||||
# validates_numericality_of :latitude, :longitude
|
||||
validates_inclusion_of :public, :inserted, :in => [ true, false]
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ class Tracetag < ActiveRecord::Base
|
|||
set_table_name 'gpx_file_tags'
|
||||
|
||||
validates_format_of :tag, :with => /^[^\/;.,?]*$/
|
||||
validates_length_of :tag, :within => 1..255
|
||||
|
||||
belongs_to :trace, :foreign_key => 'gpx_id'
|
||||
end
|
||||
|
|
|
@ -15,8 +15,9 @@ class User < ActiveRecord::Base
|
|||
validates_confirmation_of :pass_crypt, :message => 'Password must match the confirmation password'
|
||||
validates_uniqueness_of :display_name, :allow_nil => true
|
||||
validates_uniqueness_of :email
|
||||
validates_length_of :pass_crypt, :minimum => 8
|
||||
validates_length_of :display_name, :minimum => 3, :allow_nil => true
|
||||
validates_length_of :pass_crypt, :within => 8..255
|
||||
validates_length_of :display_name, :within => 3..255, :allow_nil => true
|
||||
validates_length_of :email, :within => 6..255
|
||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
||||
validates_format_of :display_name, :with => /^[^\/;.,?]*$/
|
||||
validates_numericality_of :home_lat, :allow_nil => true
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
class UserPreference < ActiveRecord::Base
|
||||
set_primary_keys :user_id, :k
|
||||
belongs_to :user
|
||||
|
||||
validates_length_of :k, :within => 1..255
|
||||
validates_length_of :v, :within => 1..255
|
||||
|
||||
# Turn this Node in to an XML Node without the <osm> wrapper.
|
||||
def to_xml_node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue