bust_rails_etags icon indicating copy to clipboard operation
bust_rails_etags copied to clipboard

Better Heroku API request

Open tmaier opened this issue 11 years ago • 0 comments

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

tmaier avatar Jan 03 '14 16:01 tmaier