pantulis (owner)

Revisions

gist: 132125 Download_button fork
public
Public Clone URL: git://gist.github.com/132125.git
Embed All Files: show embed
myrackfilter.rb #
1
2
3
4
5
6
7
8
9
10
11
Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.
 
  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )
 
  config.middleware.use "MyRackFilter", Logger.new(STDERR)
 
  ...
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
class MyRackFilter
  def initialize(app, logger = nil)
    @app = app
    @logger = logger
  end
 
  def call(env)
    @logger.debug("Hit, hit!")
    status, headers, response = @app.call(env)
  end
end