Hi --

I've been working on a per-action Rack-based after_filter-like
facility, and I thought others might like to see the experiment (and I
do consider it experimental). It's a plugin called after_middles, at:

   git://github.com/dblack/after_middles.git

It works like this (assuming Rails 2.3/edge):

   # Define something like this somewhere:
   class MyRackApp
     def call(env)
       # you already have @app here for the
       # middleware chain
       do_stuff...
       @app.call(env)
     end
   end

   # Then in your controller:
   class ThingsController < ApplicationController
     after_middle MyRackApp, :only => :show
     def show
       ...
     end
   end

It maintains its own middleware stack, and after_middle itself is just
a wrapper around before_filter that adds to that stack.

I'm not sure yet how useful it will be (either for adding
functionality or for speed), except it's already served one of its
purposes, namely to help me learn more about the recent controller
code and the implementation of the middleware integration. Anyway, if
interested, have a look, and let me know if you have any
comments.


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)

http://www.wishsight.com => Independent, social wishlist management!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to