Skip to content

Commit

Permalink
Make sure rack_cache[:verbose] can be set
Browse files Browse the repository at this point in the history
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
  • Loading branch information
jdurand committed Jan 28, 2016
1 parent 9c5fb83 commit 40ec994
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/logstasher/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Railtie < Rails::Railtie
config.logstasher.enabled = false

initializer :logstasher, :before => :load_config_initializers do |app|
app.config.action_dispatch.rack_cache[:verbose] = false if app.config.action_dispatch.rack_cache
app.config.action_dispatch.rack_cache[:verbose] = false if rack_cache_hashlike?(app)
LogStasher.setup_before(app.config.logstasher) if app.config.logstasher.enabled
end

Expand All @@ -17,5 +17,9 @@ class Railtie < Rails::Railtie
LogStasher.setup(config.logstasher) if config.logstasher.enabled
end
end

def self.rack_cache_hashlike?(app)
app.config.action_dispatch.rack_cache && app.config.action_dispatch.rack_cache.respond_to?(:[]=)
end
end
end

0 comments on commit 40ec994

Please sign in to comment.