Sha256: 204735eb561f34ba7c792cb1da7ffd381adc74e23a764d5445c4a3dea93ce9c4

Contents?: true

Size: 780 Bytes

Versions: 7

Compression:

Stored size: 780 Bytes

Contents

require 'earth/model'

require 'earth/industry/naics_2002'
require 'earth/industry/sic_1987'

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

  TABLE_STRUCTURE = <<-EOS

CREATE TABLE naics2002_sic1987_concordances
  (
     row_hash        CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     naics_2002_code CHARACTER VARYING(255),
     sic_1987_code   CHARACTER VARYING(255),
     sic_note        CHARACTER VARYING(255)
  );

EOS

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

Version data entries

7 entries across 7 versions & 1 rubygems

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