Add extra validation to messages and diary entries.
[rails.git] / app / models / diary_entry.rb
index ad334151c37f8eafc786b7a8fe9212c7d6ad523e..8894f44355cddb66feb936e40a3eb61e85ef2668 100644 (file)
@@ -1,3 +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