Class: UsdaNutrientDatabase::Import::Weights
- Defined in:
- lib/usda_nutrient_database/import/weights.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from UsdaNutrientDatabase::Import::Base
Instance Method Details
#import ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/usda_nutrient_database/import/weights.rb', line 4 def import CSV.open( "#{directory}/WEIGHT.txt", 'r:iso-8859-1:utf-8', ) do |csv| csv.each do |row| UsdaNutrientDatabase::Weight.create!( nutrient_databank_number: row[0], sequence_number: row[1], amount: row[2], measurement_description: row[3], gram_weight: row[4], num_data_points: row[5], standard_deviation: row[6] ) end end end |