Class: PostalCodeStatistic
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PostalCodeStatistic
- Defined in:
- app/models/postal_code_statistic.rb
Overview
== Schema Information
Table name: postal_code_statistics
Database name: primary
id :integer not null, primary key
code :string(10)
cold_climate_index :integer
composite_score :integer
demand_index_score :integer
msa :string(255)
msa_fip :integer
num_key_hhs :integer
rri_forecast :integer
series_date :datetime
string :string(10)
zip_code_demand_score :integer
zip_code_relative_activity_score :integer
Indexes
index_postal_code_statistics_on_code_and_series_date (code,series_date) UNIQUE
index_postal_code_statistics_on_composite_score (composite_score)
Constant Summary
Constants included from Models::Schedulable
Models::Schedulable::SIMPLE_FORM_OPTIONS
Instance Attribute Summary collapse
- #composite_score ⇒ void readonly
- #series_date ⇒ void readonly
Belongs to collapse
Class Method Summary collapse
-
.active ⇒ ActiveRecord::Relation<PostalCodeStatistic>
A relation of PostalCodeStatistics that are active.
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::Schedulable
Methods included from Models::AfterCommittable
Methods included from Models::EventPublishable
Instance Attribute Details
#composite_score ⇒ void (readonly)
This method returns an undefined value.
32 |
# File 'app/models/postal_code_statistic.rb', line 32 validates :composite_score, presence: true |
#series_date ⇒ void (readonly)
This method returns an undefined value.
34 |
# File 'app/models/postal_code_statistic.rb', line 34 validates :series_date, presence: true |
Class Method Details
.active ⇒ ActiveRecord::Relation<PostalCodeStatistic>
A relation of PostalCodeStatistics that are active. Active Record Scope
36 |
# File 'app/models/postal_code_statistic.rb', line 36 scope :active, -> { where("series_date = (select max(series_date) from postal_code_statistics r2 where r2.code = postal_code_statistics.code)") } |
Instance Method Details
#postal_code ⇒ void
This method returns an undefined value.
28 |
# File 'app/models/postal_code_statistic.rb', line 28 belongs_to :postal_code, primary_key: :code, foreign_key: :code, optional: true |