Sha256: f7256f164fe73dc30bee565da5d84f5d87d75abdab7de31e0954c09d84d2ef6f

Contents?: true

Size: 722 Bytes

Versions: 15

Compression:

Stored size: 722 Bytes

Contents

module UsdaNutrientDatabase
  class FoodsNutrient < ActiveRecord::Base
    self.table_name = 'usda_foods_nutrients'

    validates :nutrient_databank_number, presence: true,
      uniqueness: { scope: :nutrient_number, allow_blank: true }
    validates :nutrient_number, presence: true,
      uniqueness: { scope: :nutrient_databank_number, allow_blank: true }
    validates :nutrient_value, presence: true
    validates :num_data_points, presence: true
    validates :src_code, presence: true

    belongs_to :food, class_name: 'UsdaNutrientDatabase::Food',
      foreign_key: :nutrient_databank_number
    belongs_to :nutrient, class_name: 'UsdaNutrientDatabase::Nutrient',
      foreign_key: :nutrient_number
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
usda-nutrient-database-1.2.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-1.1.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-1.0.1 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-1.0.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.8.1 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.8.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.7.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.6.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.5.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.4.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.3.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.2.0 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.1.2 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.1.1 lib/usda_nutrient_database/foods_nutrient.rb
usda-nutrient-database-0.1.0 lib/usda_nutrient_database/foods_nutrient.rb