Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit cf4dc8a3be546d220212126df6a7503f67aa2149 1 parent 614a95b
@eric1234 authored
View
2  better_exception_app.gemspec
@@ -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
7 config/routes.rb
@@ -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
View
1  lib/better_exception_app/railtie.rb
@@ -1,5 +1,4 @@
class BetterExceptionApp::Engine < Rails::Engine
- isolate_namespace BetterExceptionApp
initializer 'better_exception.set_paths' do
BetterExceptionApp::HttpError.error_files_paths <<
View
3  lib/generators/better_exception_app/static_error_page/static_error_page_generator.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.