tap/app/controllers/barcodes_controller.rb
2015-10-07 15:34:22 +02:00

19 lines
400 B
Ruby

class BarcodesController < ApplicationController
load_and_authorize_resource :product
load_and_authorize_resource :barcode, through: :product
def create
@barcode.save
redirect_to barcode_products_path, notice: "Barcode successfully linked!"
end
def show
render json: @barcode.product
end
private
def barcode_params
params.require(:barcode).permit(:code)
end
end