Setting up a general Rails error message

Our rails application is designed as a single code base associated with several client databases. Based on the subdomain, the application determines which db to connect to.

We use liquid templates to customize the presentation for each client. We cannot configure the general message "We're sorry, somethign went wrong .." for each client.

Can we recommend an approach that would allow us to do this?

thank

Dóm

+3
source share
2 answers

To detect exceptions in Rails 2, the control method rescue_fromis a great way to specify actions that handle various cases.

class ApplicationController < ActionController::Base
  rescue_from MyAppError, :with => :show_errors

  def show_errors
    render :action => "..."
  end
end

"public/500.html".

+4

, , , .

0

Source: https://habr.com/ru/post/1697200/


All Articles