tap/app/controllers/barcodes_controller.rb

20 lines
415 B
Ruby
Raw Normal View History

class BarcodesController < ApplicationController
2015-10-07 15:34:22 +02:00
load_and_authorize_resource :product
2015-10-07 15:55:47 +02:00
load_and_authorize_resource :barcode, through: :product, shallow: true
def create
@barcode.save
2015-09-26 11:57:41 +02:00
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