1
我有一個問題,回形針和軌道4 當上傳的圖像,我得到以下錯誤:軌道4回形針:缺少必需的attr_accessor
Image model missing required attr_accessor for 'pic_file_name'
當添加推薦attr_accessors
attr_accessor :pic_file_name
attr_accessor :pic_content_type
attr_accessor :pic_file_size
attr_accessor :pic_updated_at
該記錄已保存,但:pic列爲空,沒有上傳任何內容。
我也試過白名單:pic_file_name
private
# Use callbacks to share common setup or constraints between actions.
def set_image
@image = Image.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def image_params
params.require(:image).permit(:title, :pic, :pic_file_name)
end
,但沒有成功。
任何想法這裏有什麼錯?
你的意思是模型? – DonMB