我试着去保存用户在表单中输入的数据,在数据库中这样上传的图片:不能显示与回形针
images_controller.rb
class ImagesController < ApplicationController
layout 'home2'
#before_action :set_image, only: [:show, :edit, :update, :destroy]
def new
@image = Image.new
end
def create
@image = Image.new(image_params)
#@image1 = Image.new(params[:image_filename])
#
if @image.save
flash[:notice] = "Your creation has been uploaded"
redirect_to "/showcase"
else
flash[:error] = "Your creation has not been uploaded"
render :new
end
end
private
def image_params
params.permit(:title, :description, :nickname, :creation)
end
end
但是,它尝试在按下提交按钮之前以基数发送数据。
在此先感谢您的帮助。
感谢您的回答,但创作是一个变量,一个错误出现,与此 – Paul
请尝试更新的答案。 – Navin