Sha256: c37b82a4655f0c9c72b724b16034e91f1dda1e7c879801a9e01b6fe05eba7423

Contents?: true

Size: 682 Bytes

Versions: 7

Compression:

Stored size: 682 Bytes

Contents

require 'earth/model'

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

  TABLE_STRUCTURE = <<-EOS

CREATE TABLE green_button_adoptions
  (
     electric_utility_name CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     implemented           BOOLEAN,
     committed             BOOLEAN
  );

EOS

  self.primary_key = "electric_utility_name"
  
  class << self
    def implemented?(*names)
      names.any? do |name|
        find_by_electric_utility_name(name).try :implemented?
      end
    end
    def committed?(*names)
      names.any? do |name|
        find_by_electric_utility_name(name).try :committed?
      end
    end
  end
  
  warn_unless_size 23
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/electricity/green_button_adoption.rb
earth-1.1.2 lib/earth/electricity/green_button_adoption.rb
earth-1.1.1 lib/earth/electricity/green_button_adoption.rb
earth-1.1.0 lib/earth/electricity/green_button_adoption.rb
earth-1.0.3 lib/earth/electricity/green_button_adoption.rb
earth-1.0.2 lib/earth/electricity/green_button_adoption.rb
earth-1.0.1 lib/earth/electricity/green_button_adoption.rb