Sha256: 7ccabc7bdab5d53700facd8904bd935a68a0edfea9231b4a99d5e82ff0e8fda6
Contents?: true
Size: 575 Bytes
Versions: 10
Compression:
Stored size: 575 Bytes
Contents
class EgridRegion < ActiveRecord::Base self.primary_key = "name" # make EgridCountry a parent so that it automatically gets data_mined (need it for fallback calculation) belongs_to :egrid_country, :foreign_key => 'country_name' has_many :egrid_subregions, :foreign_key => 'egrid_region_name' falls_back_on :name => 'fallback', :loss_factor => lambda { (EgridCountry.us.generation + EgridCountry.us.imports - EgridCountry.us.consumption) / EgridCountry.us.generation } col :name col :country_name col :loss_factor, :type => :float end
Version data entries
10 entries across 10 versions & 1 rubygems