orbit-location/app/models/location_info.rb

22 lines
666 B
Ruby
Raw Permalink Normal View History

2014-01-15 10:47:39 +00:00
class LocationInfo
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCategory::Categorizable
mount_uploader :file, LocationsUploader
field :name, localize: true
field :description, localize: true
field :longitude, type: Float
field :latitude, type: Float
validates :file, presence: true
validates :longitude,
numericality: { less_than_or_equal_to: 180.0, greater_than_or_equal_to: -180.0 },
unless: Proc.new{self.longitude.blank?}
validates :latitude,
numericality: { less_than_or_equal_to: 90.0, greater_than_or_equal_to: -90.0 },
unless: Proc.new{self.latitude.blank?}
end