Add extra validation to messages and diary entries.
[rails.git] / app / models / diary_entry.rb
index 2da92d400648a564eecc1bdd66c6841190b6245f..8894f44355cddb66feb936e40a3eb61e85ef2668 100644 (file)
@@ -1,2 +1,8 @@
 class DiaryEntry < ActiveRecord::Base
+  belongs_to :user
+
+  validates_presence_of :title, :body
+  validates_numericality_of :latitude, :allow_nil => true
+  validates_numericality_of :longitude, :allow_nil => true
+  validates_associated :user
 end