Skip to content

Commit

Permalink
KBP-140 #time 10m - Code was improved
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdibayhan committed Nov 21, 2017
1 parent 1fa9310 commit f058b96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cybele/helpers/error_pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module ErrorPages
def configure_error_pages
inject_into_file 'app/controllers/application_controller.rb',
template_content('error_pages/error_control.erb'),
before: 'self.responder'
after: 'class ApplicationController < ActionController::Base'

inject_into_file 'app/controllers/application_controller.rb',
template_content('error_pages/error_method.erb'),
Expand Down
8 changes: 5 additions & 3 deletions templates/error_pages/error_control.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

rescue_from Exception, with: :server_error if Rails.env.production? or Rails.env.staging?
rescue_from ActiveRecord::RecordNotFound, with: :page_not_found if Rails.env.production? or Rails.env.staging?
rescue_from ActionController::RoutingError, with: :page_not_found if Rails.env.production? or Rails.env.staging?

if Rails.env.production? || Rails.env.staging?
rescue_from Exception, with: :server_error
rescue_from ActiveRecord::RecordNotFound, with: :page_not_found
rescue_from ActionController::RoutingError, with: :page_not_found
end
2 changes: 1 addition & 1 deletion templates/error_pages/error_route.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

if Rails.env.production? or Rails.env.staging?
if Rails.env.production? || Rails.env.staging?
match '*unmatched_route', to: 'application#page_not_found', via: :all
end

0 comments on commit f058b96

Please sign in to comment.