Class: ActiveNutrition::Models::NutData

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/active_nutrition/models/nut_data.rb

Instance Method Summary collapse

Instance Method Details

#amount_per_gramObject

the value of Nutr_Val is the number of grams in 100 grams total, which it makes it easy to calculate the amount in every 1 gram



17
18
19
# File 'lib/active_nutrition/models/nut_data.rb', line 17

def amount_per_gram
  return self.Nutr_Val.to_f / 100.0
end