about summary refs log tree commit homepage
path: root/examples/rails_app-2.3.4/app/controllers/progress_controller.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-12 18:49:21 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-12 18:51:17 -0800
commit701405d00364c63c0efbf11a39368dd2cbee0053 (patch)
tree86a9c8ca562665e87dbae91ecfc64f837c47248b /examples/rails_app-2.3.4/app/controllers/progress_controller.rb
parentca0493aa6b53a38b6254c29b44982c369ad9757f (diff)
downloadupr-701405d00364c63c0efbf11a39368dd2cbee0053.tar.gz
Add jQuery-compatible Rails example
This uses the new Upr::JSON class to generate output.
Apparently this is the same format used by Apache, nginx, and
lighttpd.  Hopefully this will help increase upr adoption.
Diffstat (limited to 'examples/rails_app-2.3.4/app/controllers/progress_controller.rb')
-rw-r--r--examples/rails_app-2.3.4/app/controllers/progress_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/rails_app-2.3.4/app/controllers/progress_controller.rb b/examples/rails_app-2.3.4/app/controllers/progress_controller.rb
new file mode 100644
index 0000000..b3d91f3
--- /dev/null
+++ b/examples/rails_app-2.3.4/app/controllers/progress_controller.rb
@@ -0,0 +1,10 @@
+class ProgressController < ApplicationController
+  def index
+    opt = {
+      :backend => $upr,
+      :frequency => 0.5,
+      :env => request.env,
+    }
+    render(Upr::JSON.new(opt).rails_render_options)
+  end
+end