romanbsd / heroku-deflater

Enable gzip compression on heroku, but don't compress images.
MIT License
358 stars 62 forks source link

Reorder railtie method declaration to avoid undefined method #44

Closed olliebennett closed 5 years ago

olliebennett commented 5 years ago

Fixes #28

This avoids an exception when loading the gem;

gems/railties-5.2.3/lib/rails/railtie.rb:192:in `method_missing': undefined method `cache_control_manager' for HerokuDeflater::Railtie:Class (NoMethodError)

In my particular case, this caused no problems on production, but manifested when setting up Sorbet (where the bundle exec srb init command loads all code), this exception was raised.

I'm not fully aware of the implications of defining the method before the before_initialize block; are there any that I might not be considering?