TAGS:

ruby  rails  exception  handler 

Series:

How to save User Informations In `error_messages` table.

First, You must have one of the authentication methods such as devise.

Then, Uncomment the following line in /config/initializers/rails_exception_handler.rb and edit it to be:

  config.store_user_info = {:method => :current_user, :field => :email} # Helper method for easier access to current_user

Where you will store the user email as user information into ErrorMessage table and we suppose that you use current_user as used in devise.

As shown in this tutorial video :


Source on github.com

Great Note, Every time you change any file in config/initializers, You must restart server.