class ConsistencyFail::Models
Constants
- MODEL_DIRECTORY_REGEXP
Attributes
load_path[R]
Public Class Methods
new(load_path)
click to toggle source
# File lib/consistency_fail/models.rb, line 10 def initialize(load_path) @load_path = load_path end
Public Instance Methods
all()
click to toggle source
# File lib/consistency_fail/models.rb, line 27 def all ActiveRecord::Base.send(:descendants).sort_by(&:name) end
dirs()
click to toggle source
# File lib/consistency_fail/models.rb, line 14 def dirs load_path.select { |lp| MODEL_DIRECTORY_REGEXP =~ lp.to_s } end
preload_all()
click to toggle source
# File lib/consistency_fail/models.rb, line 18 def preload_all self.dirs.each do |d| ruby_files = Dir.glob(File.join(d, "**", "*.rb")).sort ruby_files.each do |model_filename| Kernel.require_dependency model_filename end end end