Class: ActiveRecord::DataIntegrity::BelongsTo::ForeignKey
- Defined in:
- lib/active_record/data_integrity/cop/belongs_to/foreign_key.rb
Overview
Checks foreign key presence to the parent table of belongs_to association
Instance Attribute Summary
Attributes inherited from Cop
Instance Method Summary collapse
Methods inherited from Cop
cop_name, #initialize, #log, #progress
Constructor Details
This class inherits a constructor from ActiveRecord::DataIntegrity::Cop
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/active_record/data_integrity/cop/belongs_to/foreign_key.rb', line 10 def call results = associations.map do |association| valid?(association) end results.none?(&:!) end |