class Import < ActiveRecord::Base belongs_to :user def finish!(messages) self.output = messages self.success = true self.finished_at = Time.now save! end def fail!(exception) self.output = exception.to_s + "\n\n" + exception.backtrace.join("\n") self.finished_at = Time.now save! end end