diff --git a/app/controllers/barcodes_controller.rb b/app/controllers/barcodes_controller.rb index d121ad6..39327eb 100644 --- a/app/controllers/barcodes_controller.rb +++ b/app/controllers/barcodes_controller.rb @@ -9,7 +9,7 @@ class BarcodesController < ApplicationController def show @barcode = Barcode.find_by(code: params[:id]) - render json: @barcode.product + render json: @barcode.try(:product) end private