Pages

Friday, 18 April 2014

Resque Handler in ruby on rails

class ApplicationController < ActionController::Base

  protect_from_forgery with: :exception

  unless Rails.env == "development"
    rescue_from Exception, with: :server_error
    rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
  end

  def server_error(exception)
    logger.info(exception)                        #add exception to production log
    render :file => "public/500-s.html", :status => 200
  end

  def record_not_found(exception)
    logger.info exception
    render :file => "public/404-s.html", :status => 200
  end

end