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