Sha256: 8bf502ee8277afcf438068709208dcb3b868a2e3d40e8f026a7ba4e7060fb3da

Contents?: true

Size: 511 Bytes

Versions: 5

Compression:

Stored size: 511 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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
usda-nutrient-database-0.3.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.2.0 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.1.2 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.1.1 lib/usda_nutrient_database/food.rb
usda-nutrient-database-0.1.0 lib/usda_nutrient_database/food.rb