json.array! @ingredients do |i| json.extract! i, :name case i when Recipe json.id "R#{i.id}" when Food json.id "F#{i.id}" else json.id nil end end