lib/evil_seed/relation_dumper.rb in evil-seed-0.1.3 vs lib/evil_seed/relation_dumper.rb in evil-seed-0.2.0

- old
+ new

@@ -122,12 +122,12 @@ # Selects attributes as a hash with typecasted values for all rows from +relation+ # @param relation [ActiveRecord::Relation] # @return [Array<Hash{String => String, Integer, Float, Boolean, nil}>] def fetch_attributes(relation) - relation.pluck(*model_class.attribute_names).map do |row| - Hash[model_class.attribute_names.zip(row)] + relation.pluck(*model_class.column_names).map do |row| + Hash[model_class.column_names.zip(row)] end end def check_limits! return true unless options[:limitable] @@ -144,10 +144,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 if model_class.attribute_names.include?(reflection.foreign_key) + nullify_columns << reflection.foreign_key if model_class.column_names.include?(reflection.foreign_key) else foreign_keys[reflection.name] = reflection.foreign_key table_names[reflection.name] = reflection.table_name end excluded