Sha256: 71c3835541831f8d95ad2e643475ee2b6b4bf8d2d455e310a501675715ee56f6

Contents?: true

Size: 685 Bytes

Versions: 5

Compression:

Stored size: 685 Bytes

Contents

class AutomobileActivityYear < ActiveRecord::Base
  self.primary_key = "activity_year"
  
  # for calculating hfc ef
  has_many :activity_year_types, :foreign_key => :activity_year, :primary_key => :activity_year, :class_name => 'AutomobileActivityYearType'
  
  # Used by Automobile and AutomobileTrip
  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
  
  col :activity_year, :type => :integer
  col :hfc_emission_factor, :type => :float
  col :hfc_emission_factor_units
  
  warn_unless_size 15
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/automobile/automobile_activity_year.rb
earth-0.12.3 lib/earth/automobile/automobile_activity_year.rb
earth-0.12.2 lib/earth/automobile/automobile_activity_year.rb
earth-0.12.1 lib/earth/automobile/automobile_activity_year.rb
earth-0.12.0 lib/earth/automobile/automobile_activity_year.rb