让我们说,我有我的seeds.rb
文件中的以下条目:seeds.rb内使用回形针
Image.create(:id => 52, :asset_file_name => "somefile.jpg", :asset_file_size => 101668, :asset_content_type => "image/jpeg", :product_id => 52)
如果我种子,它会尝试指定的图像处理,我得到这个错误:
No such file or directory - {file path} etc...
我的图像已备份,所以我不需要创建它们;但我需要记录。我无法评论我的模型中的回形针指令;那么它的工作;但我想可能有另一种解决方案。
为了实现它,还有其他的模式吗?或者让回形针告诉回形针不要处理图像?
我推荐使用'File.join'而不是内插字符串。 'File.join(Rails.root,'path','to','somefile.jpg')' – Aleksey 2016-07-06 17:27:12