diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-06-24 14:32:11 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:04 +0200 |
commit | c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154 (patch) | |
tree | c4e9df3db8971f0877380bff56cca9a1c24b037d /railties/lib | |
parent | b5975a4a30edb1b77a4d7edd6817a7445c079193 (diff) | |
download | rails-c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154.tar.gz rails-c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154.tar.bz2 rails-c989d1a87d4ed0d3f4fe425ce2207eec5a8d3154.zip |
Engine sets routes as default rack endpoint if no endpoint was given
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index a4cdc7306f..a21b560084 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -103,10 +103,6 @@ module Rails super end - def routes - @routes ||= ActionDispatch::Routing::RouteSet.new - end - def railties @railties ||= Railties.new(config) end diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 9a8dd8e8d4..c0607950b5 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -152,18 +152,21 @@ module Rails end def app - raise "You can't use Engine as rack application without providing valid rack endpoint" unless endpoint @app ||= config.middleware.build(endpoint) end def endpoint - self.class.endpoint + self.class.endpoint || routes end def call(env) app.call(env) end + def routes + @routes ||= ActionDispatch::Routing::RouteSet.new + end + def initializers initializers = [] railties.all { |r| initializers += r.initializers } |