From 3e825fd013449955e86a7a53928e431b26f46b93 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Fri, 22 Mar 2013 12:30:26 +0000 Subject: [PATCH] Validate title, lat, lon on posts --- app/models/post.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index 598edf4..87661bd 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1,5 +1,8 @@ class Post < ActiveRecord::Base belongs_to :feed + validates :title, :presence => true + validates :lat, :numericality => { :greater_than_or_equal_to => -90, :less_than_or_equal_to => 90 } + validates :lon, :numericality => { :greater_than_or_equal_to => -180, :less_than_or_equal_to => 180 } EARTH_RADIUS_METRES = 6378000