views:

1420

answers:

3

Hello

Our rails app is designed as a single code base linking to multiple client databases. Based on the subdomain the app determines which db to connect to.

We use liquid templates to customise the presentation for each client. We are unable to customise the generic 'We're Sorry, somethign went wrong..' message for each client.

Can anyone recommend an approach that would allow us to do this.

Thanks

DOm

+4  A: 

For catching exceptions in Rails 2, rescue_from controller method is a great way to specify actions which handle various cases.

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

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

This way you can make dynamic error pages to replace the static "public/500.html" page.

mislav
A: 

Hi

Thanks for the reply.

Can you elaborate on what you would replace the 'public/500.html' message with.

Dom

Dom
A: 

It's not clear if you're trying to do inline error messaging or new page error messaging, but if you want to improve the text around inline error messaging, this post provides good information.

scottru