Sha256: cd6835e2cf90dfdce000202d120613f6eaf9defad65b59aea94e48eccde598a1
Contents?: true
Size: 368 Bytes
Versions: 6
Compression:
Stored size: 368 Bytes
Contents
class Rack::Attack # Throttle POST requests to /reviews by email address # # Key: "rack::attack:#{Time.now.to_i/:period}:reviews/email:#{req.email}" throttle('reviews/email', limit: 2, period: 2.minutes) do |req| if req.path == '/reviews' && req.post? # return the email if present, nil otherwise req.params['email'].presence end end end
Version data entries
6 entries across 6 versions & 1 rubygems