Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Last active Sep 19, 2018
Embed
What would you like to do?
Example: Process-Oriented Data Import
class Import
def import_workouts(rows)
CSV.foreach(@import_file_path, {headers: true}) do |row|
attributes = row.to_hash
workout = Workout.new(attributes)
unless workout.save
workout.save(validate: false)
workout.update_column(:status, :needs_revision)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment