Sha256: 00f783c832681170c4c683b918775c856c94f807cc0dd8aa5709aa557fa3867a

Contents?: true

Size: 594 Bytes

Versions: 4

Compression:

Stored size: 594 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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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