Firstly, I'm curious why you're even trying to do this? You might want to checkout the fixture_file_upload method: http://api.rubyonrails.org/classes/ActionController/TestProcess.html#M000366
Thanks, Bruno On Thu, May 28, 2009 at 1:16 AM, jrgoodner <[email protected]> wrote: > > Hey guys and gals, I'm having some trouble using fixtures to upload > images to my database. Well, to be specific, I'd like to use fixtures > to do so, but I've only attempted it in Console. > > Here's my latest attempt at creating a Photo in console. It's mildly > successful--it uploads one image to the db--HOWEVER, it doesn't go > through any of the Photo model initialization code. There are no > thumbs, mediums, or large photos created. > > ************************** > file = RAILS_ROOT + "/public/files_for_testing/User_Pics/pic.jpg" > user = User.find(1) > avatar = Photo.new > avatar.uploaded_data = ActionController::TestUploadedFile.new > (file,'image/jpg') > avatar.user = user > avatar.save > *************************** > > Anybody have a better way of doing this, or see the issue with my > attempt? Thanks in advance! > > --Jared > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CommunityEngine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/communityengine?hl=en -~----------~----~----~----~------~----~------~--~---
