Middleware Update in Rails

Is there a way to CHANGE (DO NOT replace) middleware in rails?

So, instead of:

config.middleware.delete ::Rack::Cache config.middleware.use ::Rack::Cache, :metastore => "rails:/", :entitystore => "rails:/", :verbose => false 

I want to just write something like config.middleware.find!(::Rack::Cache).verbose = false .

UPDATE: The reason for this is that capybara-webkit prints tons of messages when running on cucumber.

+4
source share
2 answers

I ended up with:

  # Disable annoying Cache messages: config.action_controller.perform_caching = true config.action_dispatch.rack_cache = {:metastore => "rails:/", :entitystore => "rails:/", :verbose => false} 

This worked for my specific case (the Rails cache was used by Dragonfly and was no longer inserted ).

I don't think there is a way to do what I originally asked, though.

+1
source

I think for this middleware you can set the Rack environment parameter, which will be combined with its default configuration: http://rtomayko.github.com/rack-cache/configuration

+1
source

Source: https://habr.com/ru/post/1390130/


All Articles