mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Because of the sort algorithm rails uses to satisfy `after` and `before`
constraints, gems can have unintended effects on others. See
0a120a818d
Prefer making rack-attack middleware idempotent instead of relying on
the load order and the contents of the middleware stack too much.
closes #452
closes #456
13 lines
311 B
Ruby
13 lines
311 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Rack
|
|
class Attack
|
|
class Railtie < ::Rails::Railtie
|
|
initializer "rack-attack.middleware" do |app|
|
|
if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new("5.1")
|
|
app.middleware.use(Rack::Attack)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|