mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-23 14:15:51 +00:00
Merge pull request #264 from grzuy/drop_support_for_rails_3
Drop support for unmaintaned Rails 3
This commit is contained in:
commit
f91f3a403c
3 changed files with 2 additions and 8 deletions
|
|
@ -26,7 +26,7 @@ Install the [rack-attack](http://rubygems.org/gems/rack-attack) gem; or add it t
|
||||||
gem 'rack-attack'
|
gem 'rack-attack'
|
||||||
```
|
```
|
||||||
Tell your app to use the Rack::Attack middleware.
|
Tell your app to use the Rack::Attack middleware.
|
||||||
For Rails 3+ apps:
|
For Rails apps:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# In config/application.rb
|
# In config/application.rb
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,8 @@ class Rack::Attack
|
||||||
end
|
end
|
||||||
|
|
||||||
PathNormalizer = if defined?(::ActionDispatch::Journey::Router::Utils)
|
PathNormalizer = if defined?(::ActionDispatch::Journey::Router::Utils)
|
||||||
# For Rails 4+ apps
|
# For Rails apps
|
||||||
::ActionDispatch::Journey::Router::Utils
|
::ActionDispatch::Journey::Router::Utils
|
||||||
elsif defined?(::Journey::Router::Utils)
|
|
||||||
# for Rails 3.2
|
|
||||||
::Journey::Router::Utils
|
|
||||||
else
|
else
|
||||||
FallbackPathNormalizer
|
FallbackPathNormalizer
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,6 @@ require "rack/test"
|
||||||
require 'active_support'
|
require 'active_support'
|
||||||
require 'action_dispatch'
|
require 'action_dispatch'
|
||||||
|
|
||||||
# Load Journey for Rails 3.2
|
|
||||||
require 'journey' if ActionPack::VERSION::MAJOR == 3
|
|
||||||
|
|
||||||
require "rack/attack"
|
require "rack/attack"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue