Sha256: 41ca535e7525f9f5f9e3c6acaadb40aae34181a83ef248dcf92e3bea3c602b0b

Contents?: true

Size: 785 Bytes

Versions: 7

Compression:

Stored size: 785 Bytes

Contents

require 'earth/model'

require 'earth/industry/naics_2002'
require 'earth/industry/naics_2007'

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

  TABLE_STRUCTURE = <<-EOS

CREATE TABLE naics2002_naics2007_concordances
  (
     row_hash        CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     naics_2002_code CHARACTER VARYING(255),
     naics_2007_code CHARACTER VARYING(255),
     naics_2002_note CHARACTER VARYING(255)
  );

EOS

  self.primary_key = "row_hash"
  
  belongs_to :naics_2002, :foreign_key => :naics_2002_code
  belongs_to :naics_2007, :foreign_key => :naics_2007_code
  
  # for data import
  def self.extract_note(description)
    (note = description.match(/ - (.+)/)) ? note.captures.first : nil
  end
  
  warn_unless_size 1200
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/industry/naics_2002_naics_2007_concordance.rb
earth-1.1.2 lib/earth/industry/naics_2002_naics_2007_concordance.rb
earth-1.1.1 lib/earth/industry/naics_2002_naics_2007_concordance.rb
earth-1.1.0 lib/earth/industry/naics_2002_naics_2007_concordance.rb
earth-1.0.3 lib/earth/industry/naics_2002_naics_2007_concordance.rb
earth-1.0.2 lib/earth/industry/naics_2002_naics_2007_concordance.rb
earth-1.0.1 lib/earth/industry/naics_2002_naics_2007_concordance.rb