How to turn off the red/grey error help page tool in rails development environment? - ruby-on-rails

I'm trying to replicate a bug in development which come from the production environment.
When the bug occurs I should see a 500 server error, but rails is displaying the following page to me, which is not what I want:
the grey rails error page
(the error in the image is not the one I'm trying to reproduce, but it shows they error page, which is what I'm talking about here)
How can I turn off this feature from rails so it just display a 500 error that a normal user will see?
And what is this tool/page called? I usually just call it the (red) rails error page. (but in this case it is grey for some reason, I don't know why too. Does anyone know?)

Try to the following
# config/environments/development.rb
config.consider_all_requests_local = false
By default, this value is true because of the need to debug code on development environment that's why, if you change value with false then will show the error page which is designed default.
If you need to generate and design custom then the follow this tutorial.
Hope to help

What about run rails in production environment?
rails server -e production

Related

rails no error details on production

I'm having big problems with finding what is causing my rails app to return 500 internal error when I call a controller action. I tried setting the config.log_level = :debug in the production.rb environment, but rails won't write display or write any details about the error in the production.log.
If I run the same app and do the same action on my local machine in development mode, I don't get any error.
How should I reveal what is causing the error? I also tried using errorapp.com but no error will be reported there..
Thanks for help
I use the exception_notification gem link
in all my rails apps. When configured with the mail settings it will email you when an exception occurs with the error info.

for rails actionmailer, any way to debug ActionView::Template::Error errors?

In my rails 3.1 app, I do have
config.action_mailer.raise_delivery_errors = true
in my development.rb file (and, yes, have restarted by local dev server since changing that to true).
However, as I develop new email templates and run into the occasional ActionView::Template::Error
I'm not seeing any of the debugging info being put out as to which line threw the error. (As opposed to when one of my normal app views has a problem the log shows the snippet of the haml source with the problem).
IS there a way to turn on similar debugging messages for mailers?
I use rails console instead of making a web request to test action mailer. It will gives a-lot more info if an error ocures.
$ rails c
> MyMailer::maielr_name( var1, var2 ).deliver!

Why is debugging information not showing in my Rails development environment?

I've just recently upgraded from Rails 3.0.9 to 3.2.8 and I am seeing user-friendly error pages for my errors instead of the usual error messages.
I've checked the following:
Ran a Rails.env and it showed I was in development
My development.rb has config.consider_all_requests_local = true
I've searched on google and couldn't find anything else. Is there anything else I'm missing here?
Thanks!
As said in User-friendly error pages not displaying in production environment
The other criteria for showing the errors is request.local?
So maybe your ip is not showing as a local one to rails (i.e. you are using a proxy). If so or request.local? is not true you could try the patch mentioned in above question (but of course return true and not false ;)

rails 3.2 development mode is not displaying the full error page with backtrace etc

I just upgraded to rails 3.2 Everything is working fine except error pages no longer show the normal development debug info. Instead it's showing the standard production error page (white background with red text in the middle:
"We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."
Is there a new setting or something I'm missing for rails 3.2? I've read over the upgrade instructions and do not see it mentioned anywhere. I tried downgrading to 3.1.3 and the error pages work again so this is definitely a rails 3.2 issue. Thanks.
Check the config.consider_all_requests_local inside development.rb. It must be set to true in order to show full error reports.
Nicolas, I'm faced the same problem and only saw the message We're sorry, but something went wrong. and nothing in logs.
The problem was in UTF-8 characters, so adding encoding declaration to the beginning of the file solved it:
# encoding = utf-8
If neither jibiels nor Dmitrys solution helped, try out the solution mentioned here:
Rails doesnt log tempalte errors in development mode
(Maybe this also helps you, #Nicolas)

Logging stacktraces when running a Rails app on Thin

This is probably something stupid as I have never deployed a Rails app before. However:
I developed the app using WEBrick. When I got an exception, I'd get a helpful stacktrace in the console. Now I am deploying the app to Thin, running as a Windows service (I am not using Windows by choice, I hasten to add).
When the app gets an exception running in Thin, all I get in the logs is: Completed 500 Internal Server Error in 31ms. No stacktrace or description of the error. When I run it in Thin in the console I get a description of the error, but no class name or line number. I'm sure it's some simple config but a bit of googling has turned up nothing so far. Can anyone shed any light on how to get more informative error logging?
On a related note, what's the simplest and best way to set up email notifications on error in a Rails app?
Ignore me - I was being stupid. I created some extra environments for the app (a sales and a uat environment) and foolishly copied config/environments/test.rb which has
config.action_dispatch.show_exceptions = false
and I now feel quite foolish.
what's the simplest and best way to set up email notifications on error in a Rails app?
The exception_notification gem.

Resources