Module: AMC::Acts::Importable::InstanceMethods

Defined in:
lib/acts_as_importable.rb

Overview

SingletonMethods

Instance Method Summary collapse

Instance Method Details

#importObject



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/acts_as_importable.rb', line 60

def import
  to_model.tap do |new_model|
    if new_model
      new_model.legacy_id     = self.id         if new_model.respond_to?(:"legacy_id=")
      new_model.legacy_class  = self.class.to_s if new_model.respond_to?(:"legacy_class=")

      if !new_model.save
        puts "#{new_model.errors.full_messages} <#{self.class.name}:#{id}>"
      end
    end
  end
end