Carrierwave带有导轨4强参数

时间:2015-09-30 20:28:13

标签: carrierwave

我无法使用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

0 个答案:

没有答案