parsley/app/controllers/ingredients_controller.rb
Dan Elbert ffed63e0b3
Some checks failed
parsley/pipeline/head There was a failure building this commit
fixed
2018-09-12 14:17:18 -05:00

9 lines
287 B
Ruby

class IngredientsController < ApplicationController
def search
@ingredients = Food.search(params[:query]).order(:name).to_a
@ingredients.concat(Recipe.is_ingredient.search_by_name(params[:query]).order(:name).to_a)
@ingredients.sort { |a, b| a.name <=> b.name }
end
end