I want to design my 404 page in my Rails 3.0.7 app.
If I request a non existing page I get the development output
Routing Error
No route matches "/foo"
I tried the following answers in:
How to test 500.html in rails development env?
application_controller:
def local_request?
false
end
development.rb:
config.consider_all_requests_local = false
development.rb:
config.action_view.debug_rjs = false
and I also started my app with:
RAILS_ENV=production rails s
RAILS_ENV=production passenger start
None of it worked.I love how rails makes complicated tasks very simple. But it's really frustrating how really simple things turn out tu be overwhelmingly difficult, impossible to debug and you end up hacking on remote servers to work around it..
Has anyone had this problem before?
If your error pages are static you can simply go to http://localhost:3000/404.html, http://localhost:3000/500.html, etc.
Best idea I've come up with so far is to run the server in production mode locally.
rails s -e production
cheers.
Related
I am trying to find a way to check logs or debug in production I am using passenger and apache and ubuntu as server. Every time I create any scaffold and upload it to server I get error :
I have used
bundle exec rake assets:precompile RAILS_ENV=production
But getting no success but when I am running application using :
rails s -e production
I can access my controllers and views over port 3000. What is wrong with this why assets:precompile is not working properly I am adding JS files manually not using coffee script. And my javascripts files are not complied.
My question is how can I set anything in production to see a debug like in development mode like this:
Can I do this in production I am using rails 5
The production error you have shown above was a 404 error. it means that the route doesn't exist or there are no controllers methods for that route or is a model not found error.
As for adding debuggers in production, can you do it?
Yes you can.
But should you do it?
NO, because it is a BAD practice. If you wish to view and debug errors in production, check your logs for the stacktrace and work with it from there. As long as it is a rails error, it will be in log/production.log.
I have a rails4 application that is deployed to production on an apache/phusion passenger stack.
There is an edit action for a nested resource in this application that is returning a 404. The route works just fine in development, even on my local system in production mode. I'm at my wits end to troubleshoot this, any input would be most appreciated! Thanks!
I am running my application which is developed using Ruby 1.9.2, Rails 3.0.8 and MySQL 5.1 in development environment as i have problem with config.cache_classes in production environment.
Application is running fine, but after a day or two i am getting symbol table over flow run time error. After restarting the server then the application is running as usual.
Can any body help me out why this symbol table overflow run time error is coming and how to resolve it.
This can happen if you mistakenly leave class caching disabled in production.
Your rails config/environments/production.rb should have:
config.cache_classes = true
Thanks
I'm having a real tough time diagnosing a 500 error from my application running in production. I've had it working before, but after re-deploying via Capastrano I am unable to get it going.
Here are the facts:
The server is setup with nginx + passenger, and I'm using
PostgreSQL.
Static assets are working properly, as in I'm able to access them just fine in a browser.
I can access the rails console via RAILS_ENV=production bundle exec rails console and perform Active Record actions (like
retrieving data from the db).
Within console, I can run app.get("/"), which returns a 500 error as well (after first showing the query that was run to load
the model).
The production.log file is never written to. I've set permissions 777 on it just for the hell of it. I've also set the log level to
:debug with nothing to show for it.
The nginx log (which passenger also uses) shows no indication of errors, it just notifies about cache misses.
Because nothing of use is being logged, I have no idea what to do here. I've tried setting full permission on the entire app directory with no help. Restarted the server multiple times, nothing. The database is there and rails can clearly communicate with it. I'm not sure what I did to get it to run the first time around. I just don't know why rails isn't outputting anything to the log.
Okay, I figured this out. The app ran fine in development mode, so I knew something production-specific was screwing it up. I went into config/environments/production.rb and changes these settings:
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false # changed from true
config.action_controller.perform_caching = true # changed from false
And then after restarting passenger, rails showed me the error w/ stacktrace. Turns out I was forgetting to precompile the asset pipeline!
Things to check
1) Are you sure you are running in production environment?
Check to see if any entries are in the development.log file
2) Set up your app to email you when a 500 error occurs with a full stack trace. I use the Exception Notifier gem but there are plenty of other solutions for this.
3) When checking your app in the console are you sure you are starting the console in production mode? It is possible that the app is not starting up at all and you just forgot to set the production param thereby thinking that the app runs fine when it doesn't.
4) Are you getting an nginx 500 error or the Rails 500 error? If nginx then it is likely that your app is not starting at all and highly unlikely that you will get any rails error in your log file. The assets are static files and navigating to them proves nothing other than that they exist.
5) Are you sure you are checking the right folder on the server? Sounds really stupid but capistrano could be deploying the app to a folder that is different to the folder that nginx is looking for for your app so double check both the folder capistrano is deploying to and the folder that nginx is looking for are the same.
Just a suggestion, I would use puma rather than passenger. It's awesome with nginx.
My problem is passenger's log file (error.log) has nothing. Then it's a rotation log issue. Run
passenger-config reopen-logs
solved my problem. More.
Have you tried running in development mode to see if the error reports itself?
I'm having a strange problem: I'm running my server in production mode, everything is fine, but I keep getting error messages like they appear in development mode. So for example instead of a 404 page, I'm getting "No route matches "/foo" with {:method=>:get}". Also "exception notifier" stopped sending exceptions.
I put <%= "Environment: #{RAILS_ENV}" %> into a view, to double-check I am definitly in production mode, which is true. Never had this before.
I'm on rails 2.3.8 on a shared server, running passenger.
Thanks for any help,
Ron
Sounds a lot like this one:
http://code.google.com/p/phusion-passenger/issues/detail?id=109
The general recommendation is to remove the config.ru from the root of your app. It seems to confuse Passenger quite a bit.
upgrading your Phusion Passenger seems to be the solution.