lib/earth/pet/species.rb in earth-0.5.4 vs lib/earth/pet/species.rb in earth-0.6.0
- old
+ new
@@ -1,24 +1,22 @@
class Species < ActiveRecord::Base
set_primary_key :name
- force_schema do
- string 'name'
- integer 'population'
- float 'diet_emission_intensity'
- string 'diet_emission_intensity_units'
- float 'weight'
- string 'weight_units'
- float 'marginal_dietary_requirement'
- string 'marginal_dietary_requirement_units'
- float 'fixed_dietary_requirement'
- string 'fixed_dietary_requirement_units'
- float 'minimum_weight'
- string 'minimum_weight_units'
- float 'maximum_weight'
- string 'maximum_weight_units'
- end
+ col :name
+ col :population, :type => :integer
+ col :diet_emission_intensity, :type => :float
+ col :diet_emission_intensity_units
+ col :weight, :type => :float
+ col :weight_units
+ col :marginal_dietary_requirement, :type => :float
+ col :marginal_dietary_requirement_units
+ col :fixed_dietary_requirement, :type => :float
+ col :fixed_dietary_requirement_units
+ col :minimum_weight, :type => :float
+ col :minimum_weight_units
+ col :maximum_weight, :type => :float
+ col :maximum_weight_units
scope :thoroughly_researched, :conditions => 'marginal_dietary_requirement IS NOT NULL'
falls_back_on :diet_emission_intensity => lambda { weighted_average :diet_emission_intensity, :weighted_by => :population }, # kg CO2 / joule
:marginal_dietary_requirement => lambda { Species.marginal_dietary_requirement_fallback },
@@ -55,6 +53,6 @@
end
def cat?
eql? self.class[:cat]
end
-end
+end
\ No newline at end of file