我在上传图像后显示图像预览。我的视图包含具有姓名、电子邮件 ID、文件上传和图像预览的人员表。在提交按钮上,它将所有图像保存到各自的图像。我被卡住了如何保存每个图像的哈希通过回形针到各自的一个。我成功地获得了以每个人的身份作为密钥的哈希值。我有两个控制器 Person 和 Image,这个预览和保存功能适用于新的和创建的图像。
图像控制器代码:
def new
@people = Person.where("avatar_file_name is ?",nil)
end
def create
@people = Person.where("avatar_file_name is ?",nil)
p=@people.coun
u=Array.new
@people.each do |e|
u.push(e.id)
end
h=Hash.new
h=params
u.each do |x|
@newimage=h["#{x}"]
######## Here in @newimage we get hash of image
end`
end
end
得到每个图像的哈希后我必须写什么?任何人都需要更多的描述,他们可以问............提前致谢