Class: AutomobileActivityYear
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AutomobileActivityYear
- Extended by:
- Earth::Model
- Defined in:
- lib/earth/automobile/automobile_activity_year.rb
Constant Summary collapse
- TABLE_STRUCTURE =
"\nCREATE TABLE automobile_activity_years\n (\n activity_year INTEGER NOT NULL PRIMARY KEY,\n hfc_emission_factor FLOAT,\n hfc_emission_factor_units CHARACTER VARYING(255)\n );\n\n"
Class Method Summary collapse
-
.find_by_closest_year(year) ⇒ Object
Used by Automobile and AutomobileTrip.
Methods included from Earth::Model
extend_mining, extended, registry
Class Method Details
.find_by_closest_year(year) ⇒ Object
Used by Automobile and AutomobileTrip
25 26 27 28 29 30 31 |
# File 'lib/earth/automobile/automobile_activity_year.rb', line 25 def self.find_by_closest_year(year) if year > maximum(:activity_year) where(:activity_year => maximum(:activity_year)).first else where(:activity_year => [year, minimum(:activity_year)].max).first end end |