diff options
author | John Duff <duff.john@gmail.com> | 2009-07-22 22:21:06 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-07-22 22:21:06 -0500 |
commit | 0c68d23f19010379a9320690ca17a26743c8f071 (patch) | |
tree | c494e9391ba81f5099c2abf873c26e9177ccc6c3 /railties/lib/rails | |
parent | 272c504f919d187603915059572e37d3a78329cc (diff) | |
download | rails-0c68d23f19010379a9320690ca17a26743c8f071.tar.gz rails-0c68d23f19010379a9320690ca17a26743c8f071.tar.bz2 rails-0c68d23f19010379a9320690ca17a26743c8f071.zip |
make pass through error code configurable [#2817 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/rack/metal.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index b031be29af..6c0732f732 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -11,6 +11,9 @@ module Rails cattr_accessor :metal_paths self.metal_paths = ["#{Rails.root}/app/metal"] cattr_accessor :requested_metals + + cattr_accessor :pass_through_on + self.pass_through_on = 404 def self.metals matcher = /#{Regexp.escape('/app/metal/')}(.*)\.rb\Z/ @@ -36,6 +39,9 @@ module Rails def initialize(app) @app = app + @pass_through_on = {} + [*self.class.pass_through_on].each { |status| @pass_through_on[status] = true } + @metals = ActiveSupport::OrderedHash.new self.class.metals.each { |app| @metals[app] = true } freeze @@ -44,7 +50,7 @@ module Rails def call(env) @metals.keys.each do |app| result = app.call(env) - return result unless result[0].to_i == 404 + return result unless @pass_through_on.include?(result[0].to_i) end @app.call(env) end |