Sha256: a0b6cba781e292fa6441368167839e333d05145e111d0b3d034e7c503ebde773

Contents?: true

Size: 665 Bytes

Versions: 7

Compression:

Stored size: 665 Bytes

Contents

module UsdaNutrientDatabase
  class Nutrient < ActiveRecord::Base
    self.table_name = 'usda_nutrients'
    self.primary_key = 'nutrient_number'

    validates :nutrient_number, presence: true,
      uniqueness: { allow_blank: true }
    validates :units, presence: true
    validates :nutrient_description, presence: true
    validates :number_decimal_places, presence: true
    validates :sort_record_order, presence: true,
      numericality: { allow_blank: true }

    has_many :foods_nutrients,
      class_name: 'UsdaNutrientDatabase::FoodsNutrient',
      dependent: :destroy

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

Version data entries

7 entries across 7 versions & 1 rubygems

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