Explorar el Código

Validate title, lat, lon on posts

master
Adrian Short hace 11 años
padre
commit
3e825fd013
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. +3
    -0
      app/models/post.rb

+ 3
- 0
app/models/post.rb Ver fichero

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


Cargando…
Cancelar
Guardar