class AutomobileMakeModel

Constants

TABLE_STRUCTURE

Public Class Methods

custom_find(characteristics) click to toggle source

Used by Automobile and AutomobileTrip to look up a make model year considering fuel

# File lib/earth/automobile/automobile_make_model.rb, line 38
def self.custom_find(characteristics)
  if characteristics[:make] and characteristics[:model]
    # append fuel suffix to model name and search
    make_model = if characteristics[:automobile_fuel]
      find_by_make_name_and_model_name characteristics[:make].name, [characteristics[:model].name, characteristics[:automobile_fuel].suffix].join(' ')
    end
    
    # use original model name if fuel suffix didn't help
    make_model ? make_model : find_by_make_name_and_model_name(characteristics[:make].name, characteristics[:model].name)
  end
end

Public Instance Methods

model_years() click to toggle source

for deriving fuel codes and type name

# File lib/earth/automobile/automobile_make_model.rb, line 51
def model_years
  AutomobileMakeModelYear.where(:make_name => make_name, :model_name => model_name)
end