22 lines
666 B
Ruby
22 lines
666 B
Ruby
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
|