1 class DiaryEntry < ActiveRecord::Base
3 has_many :diary_comments, :include => :user,
4 :conditions => "users.visible = 1",
5 :order => "diary_comments.id"
7 validates_presence_of :title, :body
8 validates_length_of :title, :within => 1..255
9 validates_length_of :language, :within => 2..3, :allow_nil => true
10 validates_numericality_of :latitude, :allow_nil => true,
11 :greater_than_or_equal_to => -90, :less_than_or_equal_to => 90
12 validates_numericality_of :longitude, :allow_nil => true,
13 :greater_than_or_equal_to => -180, :less_than_or_equal_to => 180
14 validates_associated :user