Module: NotFound::Mixin

Defined in:
lib/not_found.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/not_found.rb', line 6

def self.included(base)
  base.class_eval do
    include ActiveSupport::Rescuable

    base.const_set('RecordNotFound', ::ActiveRecord::RecordNotFound)

    rescue_from ::ActiveRecord::RecordNotFound do |e|
      raise self::RecordNotFound.new(e.message)
    end
  end
end