diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-28 09:00:33 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-28 09:00:33 +0200 |
commit | d9aae2b56e64a4f417eaffa99e10cca274e928e7 (patch) | |
tree | 8438f6f784df9b252c0f834bc7cb9c369103d4cd /railties/lib | |
parent | 5025ae610f89989f3e15241ec7065e3d443614d9 (diff) | |
parent | 9533e0eca76b1df68a90e1ebe395d7b6a59d8e91 (diff) | |
download | rails-d9aae2b56e64a4f417eaffa99e10cca274e928e7.tar.gz rails-d9aae2b56e64a4f417eaffa99e10cca274e928e7.tar.bz2 rails-d9aae2b56e64a4f417eaffa99e10cca274e928e7.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/generators/rails/app/templates/db/seeds.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/rack/metal.rb | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/railties/lib/generators/rails/app/templates/db/seeds.rb b/railties/lib/generators/rails/app/templates/db/seeds.rb index 3174d0cb8a..bc8695e6f0 100644 --- a/railties/lib/generators/rails/app/templates/db/seeds.rb +++ b/railties/lib/generators/rails/app/templates/db/seeds.rb @@ -4,4 +4,4 @@ # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Major.create(:name => 'Daley', :city => cities.first) +# Mayor.create(:name => 'Daley', :city => cities.first) 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 |