How can I clear rails cache after deploy to heroku?

caching, deployment, heroku, ruby-on-rails

Solution

Rails has a built in rake task:

rake tmp:clear

Problem

I applied cache to my heroku rails app and it works well. But everytime I deploy to heroku, I also want to clear cache automatically. so I googled and I found this. ``` task :after_deploy, :env, :branch do |t, args| puts "Deployment Complete" puts "Cleaning all cache...." FileUtils.cd Rails.root do sh %{heroku run console} sh %{Rails.cache.clear} end end ``` but when I raked this script, it just show the heroku console command line but the Rails.cache.clear command does not typed. (I guess that is because heroku console is interactive) and ``` system "heroku console Rails.cache.clear" ``` doesn't work for cedar apps. How can I solve this problem? Thanks.

Original source

Related problems