bulk_update 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -2
- data/lib/bulk_update/active_record_inflections.rb +4 -3
- data/lib/bulk_update/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -86,6 +86,9 @@ All new, changed and deleted records are handled by ActiveRecord. This ensures,
|
|
86
86
|
4. Push to the branch (`git push origin my-new-feature`)
|
87
87
|
5. Create new Pull Request
|
88
88
|
|
89
|
-
## Copyright
|
90
89
|
|
91
|
-
|
90
|
+
## License
|
91
|
+
This project is licenced under the MIT license.
|
92
|
+
|
93
|
+
## Author
|
94
|
+
Philip Kurmann (philip (at) kman.ch)
|
@@ -196,7 +196,8 @@ module BulkUpdate
|
|
196
196
|
end
|
197
197
|
|
198
198
|
# Generate and execute SQL-Statement
|
199
|
-
condition =
|
199
|
+
condition = conditions.join(' AND ')
|
200
|
+
condition += " AND (#{conditions2.join(' OR ')})" unless conditions2.blank?
|
200
201
|
compare_columns = attribute_names.select { |e| e != 'id' }.map { |e| "#{compare_table}.#{e}" }.join(', ')
|
201
202
|
sql = "SELECT #{model.table_name}.id, #{compare_columns} FROM #{model.table_name}, #{compare_table} WHERE #{condition}"
|
202
203
|
results = ActiveRecord::Base.connection.execute sql
|
@@ -238,8 +239,8 @@ module BulkUpdate
|
|
238
239
|
end
|
239
240
|
|
240
241
|
# Generate and execute SQL-Statement
|
241
|
-
condition = conditions.join(' AND ')
|
242
|
-
condition2 = conditions2.join(' AND ')
|
242
|
+
condition = conditions.join(' AND ')
|
243
|
+
condition2 = conditions2.join(' AND ')
|
243
244
|
sql = "SELECT id, #{key} FROM #{model.table_name} WHERE #{condition} #{'AND' unless conditions.blank?} #{model.table_name}.#{key} NOT IN " +
|
244
245
|
"(SELECT #{key} FROM #{compare_table} #{'WHERE' unless conditions2.blank?} #{condition2})"
|
245
246
|
results = ActiveRecord::Base.connection.execute sql
|
data/lib/bulk_update/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulk_update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|