Skip to content

Commit

Permalink
rename gem to activerecord_batch_update (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentindemetz authored Oct 19, 2024
1 parent 4fb4c8c commit 699e64e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
batch_update (0.0.2)
activerecord_batch_update (0.0.2)
activerecord (~> 7.0)
activesupport (~> 7.0)

Expand All @@ -28,15 +28,15 @@ GEM
base64 (0.2.0)
bigdecimal (3.1.8)
byebug (11.1.3)
concurrent-ruby (1.3.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
minitest (5.24.1)
minitest (5.25.1)
mutex_m (0.2.0)
parallel (1.26.3)
parser (3.3.5.0)
Expand Down Expand Up @@ -87,7 +87,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
batch_update!
activerecord_batch_update!
byebug
rake-release
rspec
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Batch Update
# ActiveRecord Batch Update

Update multiple records with different values in an optimized number of queries.

This differs from [activerecord-import](https://github.com/zdennis/activerecord-import) because the latter issues a `INSERT ... ON DUPLICATE KEY UPDATE` statement which re-inserts the record if it happens to have been deleted in a other thread.

## Usage
Include in your Gemfile: `gem 'batch_update'`
Include in your Gemfile: `gem 'activerecord_batch_update'`

```ruby
cat1 = Cat.create!(name: 'Felix', birthday: '1990-03-13')
Expand Down
6 changes: 3 additions & 3 deletions batch_update.gemspec → activerecord_batch_update.gemspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# frozen_string_literal: true

Gem::Specification.new do |s|
s.name = 'batch_update'
s.name = 'activerecord_batch_update'
s.version = '0.0.2'
s.summary = 'Update multiple records with different values in a small number of queries'
s.description = 'A simple hello world gem'
s.description = ''
s.authors = ['Quentin de Metz']
s.email = 'quentin@pennylane.com'
s.files = Dir['{lib}/**/*.rb']
s.homepage =
'https://rubygems.org/gems/batch_update'
'https://rubygems.org/gems/activerecord_batch_update'
s.license = 'MIT'

s.required_ruby_version = '>= 3.3.4'
Expand Down
4 changes: 2 additions & 2 deletions lib/batch_update.rb → lib/activerecord_batch_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'active_support'

module BatchUpdate
module ActiveRecordBatchUpdate
extend ::ActiveSupport::Concern

# Given an array of records with changes,
Expand Down Expand Up @@ -114,5 +114,5 @@ def where_statement(primary_keys)
end

ActiveSupport.on_load(:active_record) do
include(BatchUpdate)
include(ActiveRecordBatchUpdate)
end
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'batch_update'
require 'activerecord_batch_update'

describe BatchUpdate do
describe ActiveRecordBatchUpdate do # rubocop:disable RSpec/SpecFilePathFormat
describe '#batch_update_statements' do
subject(:sql_queries) { Cat.batch_update_statements(cats, **kwargs) }

Expand Down

0 comments on commit 699e64e

Please sign in to comment.