0
第一次我使用db mysql,但後來我改爲postgres。carriwave,克隆對象如何包含圖像
我寫了一些函數來將db從sql克隆到postgres。而且我有一個來自Image表格的克隆數據庫的問題。
ImageClone.all.each do |p|
img = Image.new()
img.imageable_id = p.imageable_id
img.imageable_type = p.imageable_type
img.uploader = p.uploader
puts p.uploader #=> 'testing_image.jpg'
img.save
end
=> #<Image id: 1, imageable_id: 1, imageable_type: "ProductType", uploader: nil>
如何設置圖片url ='testing_image.jpg'。 有什麼建議嗎?