[openstreetmap/openstreetmap-website] Use activerecord-import for bulk importing tracepoint records (#2131)

Tom Hughes notifications at github.com
Wed Feb 6 18:45:45 UTC 2019


tomhughes requested changes on this pull request.



>      end
 
+    # Run the before_save and before_create callbacks, and then import them in bulk with activerecord-import
+    tracepoints.each do |tp|
+      tp.run_callbacks(:save) { false }
+      tp.run_callbacks(:create) { false }
+    end
+    Tracepoint.import(tracepoints)

Shouldn't this be `import!` to raise an exception on error? The old save calls were written that way?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2131#pullrequestreview-200739752
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190206/104f4186/attachment.html>


More information about the rails-dev mailing list