]> git.openstreetmap.org Git - rails.git/blob - app/models/diary_entry.rb
Tried to DRY the user_blocks controller. Moved the configuration of the blocking...
[rails.git] / app / models / diary_entry.rb
1 class DiaryEntry < ActiveRecord::Base
2   belongs_to :user
3   belongs_to :language, :foreign_key => 'language_code'
4   
5   has_many :diary_comments, :include => :user,
6                             :conditions => ["users.visible = ?", true],
7                             :order => "diary_comments.id"
8
9   validates_presence_of :title, :body
10   validates_length_of :title, :within => 1..255
11   #validates_length_of :language, :within => 2..5, :allow_nil => false
12   validates_numericality_of :latitude, :allow_nil => true,
13                             :greater_than_or_equal_to => -90, :less_than_or_equal_to => 90
14   validates_numericality_of :longitude, :allow_nil => true,
15                             :greater_than_or_equal_to => -180, :less_than_or_equal_to => 180
16   validates_associated :user
17   validates_associated :language
18 end