Skip to content

Commit

Permalink
Trace import: remove activerecord-import gem
Browse files Browse the repository at this point in the history
Fixes #4994
  • Loading branch information
mmd-osm committed Aug 1, 2024
1 parent 6f1ffc4 commit 5733e21
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Rails/SkipsModelValidations:
Exclude:
- 'db/migrate/*.rb'
- 'app/controllers/users_controller.rb'
- 'app/models/trace.rb'

Style/Documentation:
Enabled: false
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ gem "file_exists"

# Load rails plugins
gem "actionpack-page_caching", ">= 1.2.0"
gem "activerecord-import"
gem "active_record_union"
gem "bootstrap", "~> 5.3.2"
gem "bootstrap_form", "~> 5.0"
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ GEM
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
timeout (>= 0.4.0)
activerecord-import (1.7.0)
activerecord (>= 4.2)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
Expand Down Expand Up @@ -606,7 +604,6 @@ DEPENDENCIES
aasm
actionpack-page_caching (>= 1.2.0)
active_record_union
activerecord-import
addressable (~> 2.8)
annotate
argon2
Expand Down
4 changes: 2 additions & 2 deletions app/models/trace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ def import
tracepoints << tp
end

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

Tracepoint.import!(tracepoints)
Tracepoint.insert_all!(tracepoints.map(&:attributes))
end

if gpx.actual_points.positive?
Expand Down

0 comments on commit 5733e21

Please sign in to comment.