Skip to content

Instantly share code, notes, and snippets.

@tmaximini
Created July 15, 2011 09:52
Show Gist options
  • Save tmaximini/1084409 to your computer and use it in GitHub Desktop.
Save tmaximini/1084409 to your computer and use it in GitHub Desktop.
carrierwave trouble
# this doesn't throw error, but now file gets uploaded, nothing stored in the blog_image string field (that's my mounted uploader where carrierwave should store the image identifier in)
img_path = "#{RAILS_ROOT}/tmp/sets/"
img_name = "set_#{self.id}_#{Time.now.to_i}.png"
# save composite image to PNG
template.write(img_path + img_name) # this works, it generates the desired PNG
#save and upload to s3
tmp_image = File.open(img_path + img_name)
#self.blog_image = File.open(img_name)
self.blog_image.store!(self.blog_image.store_path(img_name))
self.write_blog_image_identifier
self.save!
# this is what i tried before and now again, it says "No such file or directory - set_49_1310723500.png"
# also this file is generated and exists in APP_ROOT/tmp/sets/ ?? maybe i am using File.open wrong?
img_path = "#{RAILS_ROOT}/tmp/sets/"
img_name = "set_#{self.id}_#{Time.now.to_i}.png"
# save composite image to PNG
template.write(img_path + img_name) # this works, it generates the desired PNG
#save and upload to s3
tmp_image = File.open(img_path + img_name)
self.blog_image = File.open(img_name)
self.save!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment