Sha256: e69ebb866fab4ca6d32a3b40fe1f01f4c77fed7de3aa1b933e67844e841fec43

Contents?: true

Size: 582 Bytes

Versions: 7

Compression:

Stored size: 582 Bytes

Contents

module UsdaNutrientDatabase
  class Food < ActiveRecord::Base
    self.table_name = 'usda_foods'
    self.primary_key = 'nutrient_databank_number'

    validates :nutrient_databank_number, presence: true,
      uniqueness: { allow_blank: true }
    validates :food_group_code, presence: true
    validates :long_description, presence: true
    validates :short_description, presence: true

    has_many :footnotes, class_name: 'UsdaNutrientDatabase::Footnote'

    belongs_to :food_group, class_name: 'UsdaNutrientDatabase::FoodGroup',
      foreign_key: :food_group_code
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
usda-nutrient-database-1.0.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.8.1 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.8.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.7.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.6.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.5.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.4.0 lib/usda_nutrient_database/food.rb