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 885bd3e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 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,11 @@ class Railtie < Rails::Railtie
LogStasher.setup(config.logstasher) if config.logstasher.enabled
end
end

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

end
end

0 comments on commit 885bd3e

Please sign in to comment.