Merge pull request #273 from grzuy/readme_dont_depend_activesupport

Don't make README examples depend on activesupport
This commit is contained in:
Corey Farwell 2018-01-31 18:16:38 -05:00 committed by GitHub
commit 39c04b311f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,7 +187,7 @@ end
# Throttle login attempts for a given email parameter to 6 reqs/minute
# Return the email as a discriminator on POST /login requests
Rack::Attack.throttle('logins/email', limit: 6, period: 60.seconds) do |req|
Rack::Attack.throttle('logins/email', limit: 6, period: 60) do |req|
req.params['email'] if req.path == '/login' && req.post?
end
@ -209,7 +209,7 @@ Rack::Attack.track("special_agent") do |req|
end
# Supports optional limit and period, triggers the notification only when the limit is reached.
Rack::Attack.track("special_agent", limit: 6, period: 60.seconds) do |req|
Rack::Attack.track("special_agent", limit: 6, period: 60) do |req|
req.user_agent == "SpecialAgent"
end