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
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
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]
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
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
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