I try to use server in development mode that gives errors on html page instead of the message "We're sorry, but something went wrong.". It starts in development mode but it does not give the error information and still gives the same silly message. How can I make it open the error info. on html page when an error is occurred.
In your environment file either development.rb or production.rb do this:
config.consider_all_requests_local = true
Related
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
Somehow my local Rails app is no longer showing detailed error messages. Instead, it shows "We're sorry, but something went wrong." by default. This means I have to check the log each time. I tried forcing the server to start in development mode by running:
RAILS_ENV=development bundle exec rails s
Any ideas on how to get the error logging back?
Instead, it shows "We're sorry, but something went wrong."
This is in production, I take it? If so, this is as intended. You don't display detailed error messages (with stacktraces and sensitive data) to end users.
So yes, either watch your logs, or set up one of the many exception tracking services (honeybadger, sentry, etc.)
If you want to do it anyway (against all advice), set this in your config/environments/production.rb
config.consider_all_requests_local = true
In my app there is a form that has been causing some users to receive the "We can't find what you're looking for" error page found in app/views/application.
The problem is that I and other people on our team have been unable to reproduce the error ourselves by going through the form ourselves in a pre-production environment with the same codebase and filling it out/submitting it with various options configured.
Rails has views for 500, 404, and 422 errors in app/public and I think I understand what causes those (500 is for code issues like syntax errors and 404 is for missing views). But I don't understand what this not_found view in public is or what causes it to be shown to the user.
Rails returns a 404 (not found) in prodution in cases when you would experience an ActiveRecord::RecordNotFoundor an ActionController::RoutingError exception in development mode.
If you want to have the same behaviour in development, change the following line in your environment config to false:
# in config/environments/development.rb
config.consider_all_requests_local = false
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.
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!