Browse Source

Validate title, lat, lon on posts

master
Adrian Short 11 years ago
parent
commit
3e825fd013
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      app/models/post.rb

+ 3
- 0
app/models/post.rb View File

@@ -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


Loading…
Cancel
Save