Skip to content

Instantly share code, notes, and snippets.

@moutten
Created July 19, 2010 15:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moutten/481558 to your computer and use it in GitHub Desktop.
Save moutten/481558 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
before_filter :delay_xhr
protected
def delay_xhr
session[:delay_ajax] = params[:delay_ajax].to_i unless params[:delay_ajax].blank?
sleep session[:delay_ajax] if !session[:delay_ajax].nil? && session[:delay_ajax] > 0 && request.xhr?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment