ruby on rails - Hiding all exception messages -



ruby on rails - Hiding all exception messages -

i'm running rails 3.0.8 webrick webserver started in production mode such command

rails_env=production rails server

i have next problem.

i've read, rails in production mode should handle exceptions , errors. i'm still having error message "activerecord::recordnotfound" when i'm trying unexisted item in production mode.

i've read

rescue_from activerecord::recordnotfound, :with => :page_not_found

such hack, think isn't rails-way.

here's production.rb file contents:

beerpub::application.configure # settings specified here take precedence on in config/application.rb # production environment meant finished, "live" apps. # code not reloaded between requests config.cache_classes = true config.whiny_nils = false # total error reports disabled , caching turned on config.consider_all_requests_local = false config.action_view.debug_rjs = false config.action_controller.perform_caching = true # specifies header server uses sending files config.action_dispatch.x_sendfile_header = "x-sendfile" # nginx: # config.action_dispatch.x_sendfile_header = 'x-accel-redirect' # if have no front-end server supports x-sendfile, # comment out , rails serve files # see in log (default :info) # config.log_level = :debug # utilize different logger distributed setups # config.logger = sysloglogger.new # utilize different cache store in production # config.cache_store = :mem_cache_store # disable rails's static asset server # in production, apache or nginx config.serve_static_assets = true # enable serving of images, stylesheets, , javascripts asset server # config.action_controller.asset_host = "http://assets.example.com" # disable delivery errors, bad email addresses ignored # config.action_mailer.raise_delivery_errors = false # enable threaded mode # config.threadsafe! # enable locale fallbacks i18n (makes lookups locale fall # i18n.default_locale when translation can not found) config.i18n.fallbacks = true # send deprecation notices registered listeners config.active_support.deprecation = :notify end

as can see, quite usual.

please, help me solve issue.

upd:

i can next error

routing error no route matches "/lol"

it's type of exception, question same. best way handle such situations?

"i've read, rails in production mode should handle exceptions , errors."

this incorrect, rails doesn't catch exceptions per-se, it's in production mode have different ways handle them.

the rescue_from method wrote absolutely correct.

many rails developers don't care rescueing recordnotfound exception simple fact that, depending on app, user did wrong.

there apps likes trap exception , perform custom actions, such redirects, rendering text or different views.

ruby-on-rails ruby-on-rails-3 webrick

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -