Class: AutomobileMakeModel
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AutomobileMakeModel
- Defined in:
- lib/earth/automobile/automobile_make_model.rb
Class Method Summary collapse
-
.custom_find(characteristics) ⇒ Object
Used by Automobile and AutomobileTrip to look up a make model year considering fuel.
Instance Method Summary collapse
-
#model_years ⇒ Object
for deriving fuel codes and type name.
Class Method Details
.custom_find(characteristics) ⇒ Object
Used by Automobile and AutomobileTrip to look up a make model year considering fuel
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/earth/automobile/automobile_make_model.rb', line 9 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 : AutomobileMakeModel.find_by_make_name_and_model_name(characteristics[:make].name, characteristics[:model].name) end end |
Instance Method Details
#model_years ⇒ Object
for deriving fuel codes and type name
22 23 24 |
# File 'lib/earth/automobile/automobile_make_model.rb', line 22 def model_years AutomobileMakeModelYear.where(:make_name => make_name, :model_name => model_name) end |