Sha256: aa8a4e4283f1a03266a309fb75aca73b3422eb22795dca5e5f9184cbea38cbe9

Contents?: true

Size: 630 Bytes

Versions: 3

Compression:

Stored size: 630 Bytes

Contents

require 'earth/locality'
require 'earth/industry/industry'

class MecsRatio < ActiveRecord::Base
  set_primary_key :name

  col :name
  col :census_region
  col :naics_code
  col :consumption_per_dollar_of_shipments, :type => :float
  
  belongs_to :industry

  def self.find_by_naics_code_and_census_region(code, census_region)
    if code.blank?
      record = nil 
    else
      code = Industry.format_naics_code code
      record = where('census_region = ? AND naics_code LIKE ?', census_region, "#{code}%").first
      record ||= find_by_naics_code_and_census_region(code[0..-2], census_region)
    end
    record
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
earth-0.11.10 lib/earth/industry/mecs_ratio.rb
earth-0.11.9 lib/earth/industry/mecs_ratio.rb
earth-0.11.8 lib/earth/industry/mecs_ratio.rb