Class: SpeedeeZone

Inherits:
ApplicationRecord show all
Defined in:
app/models/speedee_zone.rb

Overview

== Schema Information

Table name: speedee_zones
Database name: primary

id :integer not null, primary key
zip_end :integer not null
zip_start :integer not null
zone :integer not null

Indexes

by_zs_ze (zip_start,zip_end)
index_speedee_zones_on_zip_end (zip_end)

Class Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Class Method Details

.get_zone_from_zip(zip) ⇒ Object



17
18
19
# File 'app/models/speedee_zone.rb', line 17

def self.get_zone_from_zip(zip)
  SpeedeeZone.where(["speedee_zones.zip_start <= ? AND speedee_zones.zip_end >= ?", zip.to_i, zip.to_i]).first&.send("zone")
end