Hi -- I''m curious what people here on ruby-core think of this plugin: git://github.com/dblack/after_middles.git It provides (somewhat rudimentary) Rack-based after_filter-like functionality, so you can do things like: class MyMiddleware def call ... end end ... class MyController < ActionController after_middle MyMiddleware, :only => "show" end I''m working on it partly just for my own education as to the middleware integration and its implementation, but also hoping it will be useful and/or a speed gain, on a per-action basis. I''d love to get some feedback. 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: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Really cool man. I was looking for a way to allow sessions per controller or something like that. I think this would definitely work. Controller classes should be thought of as a "rack app" `PeopleController.call(env)` If you want to do per action, I''m working on pushing the env["rack.routing_args"] spec/convention. So env["rack.routing_args"]["action"] should be a standard way of retrieving that. Please continue to play with this, I really like it and it would be cool to include in 2.3 if you think the API is solid. On Sun, Jan 11, 2009 at 7:54 PM, David A. Black <dblack@rubypal.com> wrote:> > Hi -- > > I''m curious what people here on ruby-core think of this plugin: > > git://github.com/dblack/after_middles.git > > It provides (somewhat rudimentary) Rack-based after_filter-like > functionality, so you can do things like: > > class MyMiddleware > def call > ... > end > end > > ... > > class MyController < ActionController > after_middle MyMiddleware, :only => "show" > end > > I''m working on it partly just for my own education as to the > middleware integration and its implementation, but also hoping it will > be useful and/or a speed gain, on a per-action basis. I''d love to get > some feedback. > > > 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! > > > >-- Joshua Peek --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Just a thought, why not just bake this into the around_filter spec. around_filter SomeMiddleware On Sun, Jan 11, 2009 at 7:54 PM, David A. Black <dblack@rubypal.com> wrote:> > Hi -- > > I''m curious what people here on ruby-core think of this plugin: > > git://github.com/dblack/after_middles.git > > It provides (somewhat rudimentary) Rack-based after_filter-like > functionality, so you can do things like: > > class MyMiddleware > def call > ... > end > end > > ... > > class MyController < ActionController > after_middle MyMiddleware, :only => "show" > end > > I''m working on it partly just for my own education as to the > middleware integration and its implementation, but also hoping it will > be useful and/or a speed gain, on a per-action basis. I''d love to get > some feedback. > > > 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! > > > >-- Joshua Peek --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Hi -- On Sun, 11 Jan 2009, Joshua Peek wrote:> > Really cool man. > > I was looking for a way to allow sessions per controller or something > like that. I think this would definitely work. > > Controller classes should be thought of as a "rack app" > `PeopleController.call(env)` > > If you want to do per action, I''m working on pushing the > env["rack.routing_args"] spec/convention. So > env["rack.routing_args"]["action"] should be a standard way of > retrieving that. > > Please continue to play with this, I really like it and it would be > cool to include in 2.3 if you think the API is solid.Thanks. I''ll definitely keep at it. To answer the question in your second reply, about baking it into around_filter: I''ve kept it separate from the existing filter and callback mechanism (except that after_middle is implemented with before_filter), partly in the hope that as a separate mini-filter system it might be lighter-weight and faster. But I don''t know whether that''s realistic, nor whether it''s worth introducing extra framework constructs. David> On Sun, Jan 11, 2009 at 7:54 PM, David A. Black <dblack@rubypal.com> wrote: >> >> Hi -- >> >> I''m curious what people here on ruby-core think of this plugin: >> >> git://github.com/dblack/after_middles.git >> >> It provides (somewhat rudimentary) Rack-based after_filter-like >> functionality, so you can do things like: >> >> class MyMiddleware >> def call >> ... >> end >> end >> >> ... >> >> class MyController < ActionController >> after_middle MyMiddleware, :only => "show" >> end >> >> I''m working on it partly just for my own education as to the >> middleware integration and its implementation, but also hoping it will >> be useful and/or a speed gain, on a per-action basis. I''d love to get >> some feedback. >> >> >> 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! >> >>> >> > > > > -- > Joshua Peek > > >-- 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: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---