我无法使用rails 4 whitelistng
从carrierwave上传图片def create
@product=Product.new(products_params)
if @product.save
format.html{redirect_to @product,notice:'Product was added successfully'}
format.json { render :show, status: :created, location: @product }
else
flash[:error]=@product.errors.full_messages[0]
render 'new'
end
end
private
def products_params
params.fetch(:product,{}).permit(:name, :description, :price, :image)
end
end