amtest
amtest

Reputation: 700

Store an image in memory or in a browser cache with ruby on rails

Now in my rails app i have stored one image from url,that stored in my system tmp folder. But the problem is i am using heroku to running this rails app, so how will be the storing process when running with heroku?

def mail
@image = https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=5&choe=UTF-8
path_image = "/tmp/img.png"
open(@image) do |chart|
 File.open(path_image, 'wb') {|f| f.write chart.read }
end
welcome(path_image)
end

Thanks

Upvotes: 0

Views: 542

Answers (1)

Samy Dindane
Samy Dindane

Reputation: 18706

As explained in Heroku's Dev Center, you can store temporary files in the #{RAILS_ROOT}/tmp/ (Rails 2) or Rails.root.join('tmp') (Rails 3) directories.

Upvotes: 2

Related Questions