Ruby on rails Heroku网站因Rails 3.2.9和路由限制而崩溃

Ruby on rails Heroku网站因Rails 3.2.9和路由限制而崩溃,ruby-on-rails,ruby,ruby-on-rails-3,heroku,ruby-on-rails-3.2,Ruby On Rails,Ruby,Ruby On Rails 3,Heroku,Ruby On Rails 3.2,我的网站位于Heroku,在Rails 3.2.8上运行良好。我将路由约束类与高压gem一起用于静态(大部分)网页: routes.rb: get "/*id" => "high_voltage/pages#show", constraints: Constraints::StaticPage.new 我在/lib/constraints/static\u page.rb中有一个文件: module Constraints class StaticPage def match

我的网站位于Heroku,在Rails 3.2.8上运行良好。我将路由约束类与高压gem一起用于静态(大部分)网页: routes.rb:

get "/*id" => "high_voltage/pages#show", constraints: Constraints::StaticPage.new
我在
/lib/constraints/static\u page.rb中有一个文件:

module Constraints
  class StaticPage
    def matches?(request)
      File.exist? file_path(request.path)
    end

    private

    def file_path(view)
      static_page_views_dir.to_s.concat("#{view}.html.erb")
    end

    def static_page_views_dir
      Rails.root.join('app', 'views', 'pages')
    end
  end
end
require 'constraints/static_page'
问题是,我刚刚更新到Rails 3.2.9,做了一次git push heroku,我的应用程序崩溃了:(

显然,Ruby/Heroku找不到我的
约束::StaticPage
类。我的
路由顶部有
require
d。rb

module Constraints
  class StaticPage
    def matches?(request)
      File.exist? file_path(request.path)
    end

    private

    def file_path(view)
      static_page_views_dir.to_s.concat("#{view}.html.erb")
    end

    def static_page_views_dir
      Rails.root.join('app', 'views', 'pages')
    end
  end
end
require 'constraints/static_page'
Rails 3.2.9中是否发生了一些变化,不再适用于Heroku?在本地,一切正常,只是在Heroku中没有。如果在我的路线中去掉该约束,一切正常(除了没有这些约束)。以下是我的
Heroku日志
输出:

2012-11-14T20:14:36+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-11-14T20:14:36+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-11-14T20:14:38+00:00 app[web.1]: => Booting WEBrick
2012-11-14T20:14:38+00:00 app[web.1]: => Rails 3.2.9 application starting in production on http://0.0.0.0:18361
2012-11-14T20:14:38+00:00 app[web.1]: => Call with -d to detach
2012-11-14T20:14:38+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-11-14T20:14:38+00:00 app[web.1]: Exiting
2012-11-14T20:14:38+00:00 app[web.1]: /app/config/routes.rb:50:in `block in <top (required)>': uninitialized constant ActionDispatch::Routing::Mapper::Constraints::StaticPage (NameError)
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:260:in `draw'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/config/routes.rb:3:in `<top (required)>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:40:in `each'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:42:in `each'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:40:in `load_paths'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/devise-2.1.2/lib/devise/rails.rb:14:in `block in <class:Engine>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:16:in `reload!'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:108:in `reload_routes!'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:34:in `call'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<top (required)>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/config.ru:4:in `block in <main>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/config.ru:1:in `new'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/config.ru:1:in `<main>'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/commands/server.rb:46:in `app'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/commands/server.rb:70:in `start'
2012-11-14T20:14:38+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:55:in `block in <top (required)>'
2012-11-14T20:14:38+00:00 app[web.1]:   from script/rails:6:in `require'
2012-11-14T20:14:38+00:00 app[web.1]:   from script/rails:6:in `<main>'
2012-11-14T20:14:40+00:00 heroku[web.1]: Process exited with status 1
2012-11-14T20:14:40+00:00 heroku[web.1]: State changed from starting to crashed
2012-11-14T20:14:36+00:00应用程序[web.1]:弃用警告:您的供应商/插件中有Rails 2.3样式的插件!Rails 4.0将删除对这些插件的支持。将它们移出并捆绑到您的Gemfile中,或将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关此方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-release(从at/app/config/environment.rb:5调用)
2012-11-14T20:14:36+00:00应用程序[网站1]:弃用警告:您的供应商/插件中有Rails 2.3样式的插件!Rails 4.0将删除对这些插件的支持。将它们移出并捆绑到您的Gemfile中,或将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关此方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-release(从at/app/config/environment.rb:5调用)
2012-11-14T20:14:38+00:00应用程序[web.1]:=>启动WEBrick
2012-11-14T20:14:38+00:00应用程序[web.1]:=>Rails 3.2.9应用程序于http://0.0.0.0:18361
2012-11-14T20:14:38+00:00应用程序[web.1]:=>使用-d调用以分离
2012-11-14T20:14:38+00:00应用程序[web.1]:=>Ctrl-C关闭服务器
2012-11-14T20:14:38+00:00应用程序[web.1]:退出
2012-11-14T20:14:38+00:00应用程序[web.1]:/app/config/routes.rb:50:in'block-in':未初始化的常量ActionDispatch::Routing::Mapper::Constraints::StaticPage(NameError)
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/action\u dispatch/routing/route\u set.rb:282:in'instance\u exec'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/action\u dispatch/routing/route\u set.rb:282:in'eval\u block'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/action\u dispatch/routing/route\u set.rb:260:in'draw'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/config/routes.rb:3:in`'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes\u reloader.rb:40:in“加载路径中的块”
2012-11-14T20:14:38+00:00应用程序[网站1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes\u reloader.rb:40:in'each'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:34:in“execute\u hook”
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:43:“运行中的块加载\u hooks”
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:42:in'each'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:42:in'run\u load\u hooks'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/finisher.rb:52:in'block in'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes\u reloader.rb:40:in'load\u path'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/designe-2.1.2/lib/designe/rails.rb:14:in'block in'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:16:in“reload!”
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:108:在“重新加载路由”中
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:34:in'call'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:55:“运行中的块初始化器”
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in'run_initializer'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/config/environment.rb:5:in`'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in'method_missing'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/config.ru:4:在“阻止中”
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:136:in'initialize!'
2012-11-14T20:14:38+00:00应用程序[网站1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:在'each'中
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:在“实例评估”中
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in'run'
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/config.ru:1:在“new”中
2012-11-14T20:14:38+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9
# config/initializers/high_voltage.rb
HighVoltage.route_drawer = HighVoltage::RouteDrawers::Root