Permalink
Browse files

Remove engine isolation

The isolation only caused problems because the layout couldn't access
application routes. A isolated engine really needs it's own layout. But that
would defeat the whole purpose of the gem.

The namespacing of the models and controllers provides enough isolation.
  • Loading branch information...
1 parent 614a95b commit cf4dc8a3be546d220212126df6a7503f67aa2149 @eric1234 committed Mar 21, 2013
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'better_exception_app'
- s.version = '0.0.4'
+ s.version = '0.1.0'
s.homepage = 'https://github.com/eric1234/better_exception_app'
s.author = 'Eric Anderson'
s.email = 'eric@pixelwareinc.com'
View
@@ -1,3 +1,6 @@
-BetterExceptionApp::Engine.routes.draw do
- match '/:status' => 'http_errors#show', :status => /\d{3}/
+Rails.application.routes.draw do
+ scope :module => :better_exception_app do
+ match ':status' => 'http_errors#show', :status => /\d{3}/,
+ :via => :get, :as => :http_error
+ end
end
@@ -1,5 +1,4 @@
class BetterExceptionApp::Engine < Rails::Engine
- isolate_namespace BetterExceptionApp
initializer 'better_exception.set_paths' do
BetterExceptionApp::HttpError.error_files_paths <<
@@ -5,6 +5,7 @@ class BetterExceptionApp::StaticErrorPageGenerator < Rails::Generators::NamedBas
def generate_page
# To avoid reading the existing static files.
BetterExceptionApp::HttpError.error_files_paths.replace []
+ Rails.configuration.middleware.delete Rack::File
status = if file_name =~ /^\d{3}$/
file_name
@@ -14,7 +15,7 @@ def generate_page
request = Rack::MockRequest.env_for "/#{status}"
request['action_dispatch.exception'] = StandardError.new 'generator'
- status, headers, response = *BetterExceptionApp::Engine.call(request)
+ status, headers, response = *Rails.application.routes.call(request)
create_file "public/errors/#{file_name}.html", response.body
end

0 comments on commit cf4dc8a

Please sign in to comment.