Geo
Geo

Reputation: 96897

How can I create some Paperclip objects from a Rake task?

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?

Upvotes: 3

Views: 919

Answers (1)

clyfe
clyfe

Reputation: 23770

Try:

Idea.new(
  :name => 'bla',
  :file1 => File.open('/some/path/to.file'),
  :file2 => File.open('/some/path/to.file')
)

Upvotes: 4

Related Questions