1

I followed the tutorial here to create custom error pages:

http://wearestac.com/blog/dynamic-error-pages-in-rails

When I got to /404, /500, and /424, I can view my custom error pages locally. However, after deploying with Heroku, I'm finding that my custom error pages aren't loading and, instead, the app is defaulting to the static 404.html and 500.html pages. How can I go about fixing this error?

I also tried the fix suggested in this post, but it didn't work for me:

User-friendly error pages not displaying in production environment

routes.rb

  %w( 404 422 500 ).each do |code|
    get code, :to => "errors#show", :code => code
  end

errors_controller.rb

class ErrorsController < ApplicationController
    def show
        render status_code.to_s, :status => status_code
    end

    protected

    def status_code
        params[:code] || 500
    end

end
Community
  • 1
  • 1
scientiffic
  • 9,045
  • 18
  • 76
  • 149

2 Answers2

0

After deleting the 500.html, 400.html, and 404.html pages from the public view folder, my custom error pages display correctly.

scientiffic
  • 9,045
  • 18
  • 76
  • 149
0

You can try to set them in Heroku Console. Login to Heroku > yourapp > setting > there you'll get an options to change your pages.

This could help https://devcenter.heroku.com/articles/error-pages

techvineet
  • 5,041
  • 2
  • 30
  • 28