Sha256: 05a147f9753797a448402a87e58750ac8e1b9054977bc8081e356c2e6d3fd6f8

Contents?: true

Size: 788 Bytes

Versions: 7

Compression:

Stored size: 788 Bytes

Contents

require 'earth/model'

class AutomobileActivityYearTypeFuel < ActiveRecord::Base
  extend Earth::Model

  TABLE_STRUCTURE = <<-EOS

CREATE TABLE automobile_activity_year_type_fuels
  (
     name                   CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     activity_year          INTEGER,
     type_name              CHARACTER VARYING(255),
     fuel_family            CHARACTER VARYING(255),
     distance               FLOAT,
     distance_units         CHARACTER VARYING(255),
     fuel_consumption       FLOAT,
     fuel_consumption_units CHARACTER VARYING(255)
  );

EOS

  self.primary_key = "name"
  
  # Used by AutomobileFuel to get records from latest activity year
  def self.latest
    where :activity_year => maximum(:activity_year)
  end
  
  warn_unless_size 120
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/automobile/automobile_activity_year_type_fuel.rb
earth-1.1.2 lib/earth/automobile/automobile_activity_year_type_fuel.rb
earth-1.1.1 lib/earth/automobile/automobile_activity_year_type_fuel.rb
earth-1.1.0 lib/earth/automobile/automobile_activity_year_type_fuel.rb
earth-1.0.3 lib/earth/automobile/automobile_activity_year_type_fuel.rb
earth-1.0.2 lib/earth/automobile/automobile_activity_year_type_fuel.rb
earth-1.0.1 lib/earth/automobile/automobile_activity_year_type_fuel.rb