Ruby on rails 保存文件时没有此类文件或目录

Ruby on rails 保存文件时没有此类文件或目录,ruby-on-rails,ruby,file,Ruby On Rails,Ruby,File,我的密码在这里 File.open("#{Rails.root}/public/images/test.png","wb") do |file| file.write(Base64.decode64(params[:image_data])) end 它没有给我们这样的文件或目录test.png我想在images文件夹test.png中装入一个文件并保存数据,而我的文件夹的权限是写、读和访问问题是,它在{Rails.root}/public/images/文件夹中查找tes

我的密码在这里

File.open("#{Rails.root}/public/images/test.png","wb") do |file|
      file.write(Base64.decode64(params[:image_data]))
    end

它没有给我们这样的文件或目录test.png我想在images文件夹test.png中装入一个文件并保存数据,而我的文件夹的权限是写、读和访问

问题是,它在
{Rails.root}/public/images/
文件夹中查找
test.png
,而这个文件夹不在那里

尝试同样的方法,将名为
test.png
的虚拟文件放在images文件夹中,然后它就可以工作了