Module: WaitAMinute::ControllerHelpers

Defined in:
lib/wait_a_minute.rb

Overview

WaitAMinute::ControllerHelpers

Instance Method Summary collapse

Instance Method Details

#prevent_dosObject

this will be called as a before filter



43
44
45
# File 'lib/wait_a_minute.rb', line 43

def prevent_dos
  render_dos unless WaitAMinuteRequestLog.allow_request?(request)
end

#render_dosObject

this will be called if IP exceeds allowed calls



48
49
50
51
52
53
54
# File 'lib/wait_a_minute.rb', line 48

def render_dos
  respond_to do |type|
    type.html { render :template => "wait_a_minute/wait_a_minute", :status => 503, :layout => WaitAMinute.layout }
    type.all  { render :nothing => true, :status => 503 }
  end
  true
end