瀏覽代碼

Validate title, lat, lon on posts

master
Adrian Short 11 年之前
父節點
當前提交
3e825fd013
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. +3
    -0
      app/models/post.rb

+ 3
- 0
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


Loading…
取消
儲存