Sha256: 6f4401b36f314fc9c9e2b165def601ac4c2ed4ff6da11e0c43715e3e89d2930a
Contents?: true
Size: 838 Bytes
Versions: 5
Compression:
Stored size: 838 Bytes
Contents
module ActiveAdmin class Error < RuntimeError end class ErrorLoading < Error # Locates the most recent file and line from the caught exception's backtrace. def find_cause(folder, backtrace) backtrace.grep(/\/(#{folder}\/.*\.rb):(\d+)/){ [$1, $2] }.first end end class DatabaseHitDuringLoad < ErrorLoading def initialize(exception) file, line = find_cause(:app, exception.backtrace) super "Your file, #{file} (line #{line}), caused a database error while Active Admin was loading. This " + "is most common when your database is missing or doesn't have the latest migrations applied. To " + "prevent this error, move the code to a place where it will only be run when a page is rendered. " + "Original error message: #{exception.message}" end end end
Version data entries
5 entries across 5 versions & 2 rubygems