Sha256: 5a5536f196cf76f3b73a5e4e4f733b1453c11a8a99ad5434278c575b880de036

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

= SimplificatorInfrastructure

This project rocks and uses MIT-LICENSE.


SimplificatorInfrastructure provides re-usable code for Rails Webapps.

== Error Pages

Shows neat error pages when exceptions are raised.
It is implemented as exception app which is a special rack app which gets called when an error occurs inside the rack middleware chain.


=== Installation

````
  gem 'simplificator_infrastructure'
````


=== Usage

In order to enable the error page handling do something like this:

````
  SimplificatorInfrastructure::ErrorPageHandler.register

  # As this will hide useful information for developers
  # you might want to do this depending on the environment
  if Rails.env.production?
    SimplificatorInfrastructure::ErrorPageHandler.register
  end

````

Note: it's best if you do this in an after_initialize block or in an initializer file (initializers/*.rb) because
in order for the error pages to work consider_all_requests_local needs to be false.
Some environments set it to true which might override this again because of the order of the calls.

=== Customize Error pages

You can add an error page per HTTP status code. I.e. a custom 500, 404, ... error page. The gem comes with

* 404 (is shown when a routing error occurs)
* generic (is shown in all other cases)

If a specific page is present then it is rendered, else the generic one is shown.

To add or customize an error page you can add a view at

app/views/errors/xxx.html.something

where XXX is the status code

Or add

app/views/errors/generic_error.html.erb to replace the generic error view.

=== Translations

Translations are provided for

* de
* en

If you want to add more translations just add the keys to your locale files.

Please make sure that I18n has

* available_locales
* default_locale

properly set.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplificator_infrastructure-0.0.3 README.rdoc
simplificator_infrastructure-0.0.2 README.rdoc