bust_rails_etags
bust_rails_etags copied to clipboard
Better Heroku API request
Hi @n8,
thank you for the idea to take the heroku version into account. I came up with a slightly improved API call, which just returns the current release and not all of them.
ENV['ETAG_VERSION_ID'] =
Heroku::API.new(api_key: Figaro.env.heroku_api_key)
.get_release(Figaro.env.heroku_app, :current)
.body['name']
I also want to note, that this gem might be obsolete with Rails 4. Rails 4 introduced controller-wide ETags.
class ApplicationController < ActionController::Base
etag { ENV['ETAG_VERSION_ID'] }
# ...
end