Sinatra/Rack Around Filter

339 views
Skip to first unread message

Alex Chaffee

unread,
Nov 19, 2009, 3:51:04 PM11/19/09
to sina...@googlegroups.com
Since Sinatra now has before and after filters, I thought it'd be nice to share a trick Daniel Neighman taught me on how to make an Around filter in any Rack app. Check out this gist, which turns on ActiveRecord query caching for all Sinatra requests. It's just a regular Rack middleware component.


I've also got one that times every request and outputs the duration to ActiveRecord::Base.logger if anyone's interested.
Reply all
Reply to author
Forward
0 new messages