Method: Engine2::Model#verify_associations

Defined in:
lib/engine2/model.rb

#verify_associationsObject



165
166
167
168
169
170
171
172
173
174
175
# File 'lib/engine2/model.rb', line 165

def verify_associations
    one_to_many_associations.each do |name, assoc|
        other = assoc.associated_class
        other_type_info = other.type_info
        if other_keys = assoc[:keys]
            other_keys.each do |key|
                raise E2Error.new("No key '#{key}' found in model '#{other}' being related from #{self}") unless other_type_info[key]
            end
        end
    end
end