开发者

Using rake db:seed with file uploads

I have an app t开发者_如何学Gohat uses Paperclip, and I am also using rake db:seed to generate some demo accounts that can be used to help bring in new users.

Part of the information these demo accounts should contain are access to profile photos and other files that would be hosted on Amazon S3.

A sample of one entry in the seeds file:

userdemo = User.find_or_create_by_login(:login => "demo",
    :email => user.email,
    :user_type => "admin",
    :password => "demo",
    :password_confirmation => "demo")

How can I create the above user along with a profile photo? This would include uploading a file from my hard drive to S3 and associating that file with this record. Thanks!


I'd suggest using uploading a fixture image, as per this other SO thread

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜