lib/evil_seed/relation_dumper.rb in evil-seed-0.1.1 vs lib/evil_seed/relation_dumper.rb in evil-seed-0.1.2
- old
+ new
@@ -142,10 +142,10 @@
def setup_belongs_to_reflections
model_class.reflect_on_all_associations(:belongs_to).reject do |reflection|
next false if reflection.options[:polymorphic] # TODO: Add support for polymorphic belongs_to
excluded = root.excluded?("#{association_path}.#{reflection.name}") || reflection.name == inverse_reflection
if excluded
- nullify_columns << reflection.foreign_key
+ nullify_columns << reflection.foreign_key if model_class.attribute_names.include?(reflection.foreign_key)
else
foreign_keys[reflection.name] = reflection.foreign_key
table_names[reflection.name] = reflection.table_name
end
excluded