15 lines
345 B
Ruby
15 lines
345 B
Ruby
# frozen_string_literal: true
|
|
|
|
module FicTracker::Models
|
|
def self.const_missing(const)
|
|
raise 'No database connected' unless FicTracker.database
|
|
|
|
model = const.to_s.downcase
|
|
require_relative "models/#{model}"
|
|
|
|
mod = const_get(const) if const_defined? const
|
|
return mod if mod
|
|
|
|
raise "Model not found: #{const}"
|
|
end
|
|
end
|