small display fixes
This commit is contained in:
parent
edfd6f12d6
commit
9cc9fb2c2f
@ -14,15 +14,9 @@ class RecipeIngredient < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def display_name
|
||||
if quantity.present? && units.present?
|
||||
"#{quantity} #{units} #{name}"
|
||||
elsif quantity.present?
|
||||
"#{quantity} #{name}"
|
||||
elsif units.present?
|
||||
"#{units} #{name}"
|
||||
else
|
||||
name
|
||||
end
|
||||
str = [quantity, units, name].delete_if { |i| i.blank? }.join(' ')
|
||||
str << ", #{preparation}" if preparation.present?
|
||||
str
|
||||
end
|
||||
|
||||
def scale(factor, auto_unit = false)
|
||||
|
@ -2,6 +2,7 @@ namespace :usda do
|
||||
|
||||
desc 'Empties usda_foods table, imports all data, and then updates any linked ingredients'
|
||||
task import: :environment do
|
||||
require 'usda_importer'
|
||||
importer = UsdaImporter.new(Rails.root.join('vendor', 'data', 'usda'))
|
||||
importer.import
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user