Class: ActiveSanity::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/active_sanity/checker.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.check!Object



3
4
5
# File 'lib/active_sanity/checker.rb', line 3

def self.check!
  new.check!
end

Instance Method Details

#check!Object



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

def check!
  puts "Sanity Check"
  puts "Checking the following models: #{models.join(', ')}"

  # TODO: Wouldnt this list already be checked by the next all records call if those records do exist?
  # This will validate and destroy the records that either dont exist currently, or are now valid. But the ones are continue to be invalid - these will
  # have been run through the validation process twice
  check_previously_invalid_records
  check_all_records
end

#modelsArray

Returns of [ActiveRecord::Base] direct descendants.

Returns:

  • (Array)

    of [ActiveRecord::Base] direct descendants



19
20
21
22
23
24
25
# File 'lib/active_sanity/checker.rb', line 19

def models
  return @models if @models

  load_all_models

  @models ||= direct_active_record_base_descendants
end