1 class DiaryEntry < ActiveRecord::Base
3 belongs_to :language, :foreign_key => 'language_code'
5 has_many :diary_comments, :include => :user,
7 :users => { :visible => true },
10 :order => "diary_comments.id"
12 validates_presence_of :title, :body
13 validates_length_of :title, :within => 1..255
14 #validates_length_of :language, :within => 2..5, :allow_nil => false
15 validates_numericality_of :latitude, :allow_nil => true,
16 :greater_than_or_equal_to => -90, :less_than_or_equal_to => 90
17 validates_numericality_of :longitude, :allow_nil => true,
18 :greater_than_or_equal_to => -180, :less_than_or_equal_to => 180
19 validates_associated :user
20 validates_associated :language