Class: DatabaseConsistency::Checkers::AssociationChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/database_consistency/checkers/association_checker.rb

Overview

The base class for association checkers

Direct Known Subclasses

MissingIndexChecker

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseChecker

checker_name, enabled?, #enabled?, #report, #report_if_enabled?

Constructor Details

#initialize(model, association) ⇒ AssociationChecker

Returns a new instance of AssociationChecker.



9
10
11
12
# File 'lib/database_consistency/checkers/association_checker.rb', line 9

def initialize(model, association)
  @model = model
  @association = association
end

Instance Attribute Details

#associationObject (readonly)

Returns the value of attribute association.



7
8
9
# File 'lib/database_consistency/checkers/association_checker.rb', line 7

def association
  @association
end

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/database_consistency/checkers/association_checker.rb', line 7

def model
  @model
end

Instance Method Details

#column_or_attribute_nameObject



14
15
16
# File 'lib/database_consistency/checkers/association_checker.rb', line 14

def column_or_attribute_name
  @column_or_attribute_name ||= association.name.to_s
end

#table_or_model_nameObject



18
19
20
# File 'lib/database_consistency/checkers/association_checker.rb', line 18

def table_or_model_name
  @table_or_model_name ||= model.name.to_s
end