[英]How can I create some Paperclip objects from a Rake task?
我有一個模型Idea
,其中包含has_attached_file :file1
和has_attached_file :file2
。 出於開發目的,我有一個“bootstrap”任務,負責創建一些初始對象(只是為了不必創建用戶,然后每次我們刪除sqlite文件時上傳一些文件)。 我應該如何從Rake任務中做到這一點?
嘗試:
Idea.new(
:name => 'bla',
:file1 => File.open('/some/path/to.file'),
:file2 => File.open('/some/path/to.file')
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.