Sha256: 89eea54815db082f6c948e3c13be3cf289b418cd77d2e7c2b6eaaa6eac25f561

Contents?: true

Size: 683 Bytes

Versions: 4

Compression:

Stored size: 683 Bytes

Contents

# TODO replace this with NAICS 2002?
class Industry < ActiveRecord::Base
  self.primary_key = "naics_code"
  
  has_many :merchant_category_industries, :foreign_key => 'naics_code'
  
  has_many :industry_product_lines, :foreign_key => 'naics_code'
  has_many :product_lines, :through => :industry_product_lines
  
  has_many :industry_sectors, :foreign_key => 'naics_code'
  has_many :sectors, :through => :industry_sectors
  
  col :naics_code
  col :description
  
  class << self
    def format_naics_code(input)
      "%d" % input.to_i
    end
  end
  
  def trade_industry?
    prefix = naics_code.to_s[0,2]
    %w{42 44 45}.include?(prefix)
  end

  warn_unless_size 2341
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/industry/industry.rb
earth-0.12.3 lib/earth/industry/industry.rb
earth-0.12.2 lib/earth/industry/industry.rb
earth-0.12.1 lib/earth/industry/industry.rb