我的画廊#create:
def create
@gallery = Gallery.new(gallery_args)
if @gallery.save!
redirect_to :back
end
end
上传的照片缩略图下显示的错误为红色:
ActionController::ParameterMissing in GalleriesController#create
param is missing or the value is empty: gallery
知道有人如何解决它吗?
更新
def gallery_args
params.require(:gallery).permit(:image)
end
答案 0 :(得分:1)
您需要向控制器添加强参数
private
def gallery_params
params.require(:gallery).permit(:gallery)
end
答案 1 :(得分:1)
您是否在Dropzone初始化中指定了paramName?
coffeescript中的示例:
dropzone = new Dropzone 'form#new_upload',
paramName: "upload[image]"
...