I have a model Idea
which has_attached_file :file1
and has_attached_file :file2
. For development purposes, I have a "bootstrap" task which is responsible of creating some initial objects ( just so that you don't have to create a user, then upload some files each and every time we delete the sqlite file ). How should I do this from a Rake task?
Try:
Idea.new(
:name => 'bla',
:file1 => File.open('/some/path/to.file'),
:file2 => File.open('/some/path/to.file')
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.