activerecord-insert_many 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80858a96eab2d052b3e8e9c010c71e60afd661e3
4
- data.tar.gz: 11f413e632930be554c76cf3b3f1bb5515495ae8
3
+ metadata.gz: 26499d66ec045253bddd9bc7d7602b5cf8a3c882
4
+ data.tar.gz: 0837ff9eb27fef0043e55eb39d77ef350fe93f67
5
5
  SHA512:
6
- metadata.gz: 99becdc88df9010ed243557540f2ea76f0f8b40e0a86ef6f11e26230bca7a9d11bb7051242bcf42e204adc10d2f80b4dff73db7110b112289950b641d938a239
7
- data.tar.gz: f2e62b0591f61b2e408e82029b0582d424bd6b711fa50365623bc90954430671fe23a8b51b934bc3f042c53fbfb1c0ebf62175e8551486d68848d4ff6ae139f0
6
+ metadata.gz: 401c21bed238f15664a8d02aafef065f0f00e05575b7ad97e23407c9f3a085ae12bd273885398cda06897da809cc6ce4769ebe7927800c9c0ead10e05ff6e630
7
+ data.tar.gz: 5b5f291346c4eb639d1c6848e904d955bdcaa20102f5d70424235b7bedd985f86a30a2a338073d4aa9a53ffa543d26ee074f78cef1c8f4f052ea12f6b54f5d73
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "activerecord"
20
+ spec.add_dependency "activerecord", ">= 5.0"
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.10"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
@@ -19,8 +19,23 @@ module ActiveRecord
19
19
  key_list = sample.map { |name, value| quote_column_name(name) }
20
20
 
21
21
  value_lists = fixtures.map do |fixture|
22
- fixture.map do |name, value|
23
- quote(value, columns[name.to_s])
22
+
23
+ binds = fixture.map do |name, value|
24
+ name = name.to_s
25
+ if column = columns[name]
26
+ type = lookup_cast_type_from_column(column)
27
+ Relation::QueryAttribute.new(name, value, type)
28
+ else
29
+ raise Fixture::FixtureError, %(table "#{table_name}" has no column named #{name.inspect}.)
30
+ end
31
+ end
32
+
33
+ prepare_binds_for_database(binds).map do |value|
34
+ begin
35
+ quote(value)
36
+ rescue TypeError
37
+ quote(YAML.dump(value))
38
+ end
24
39
  end
25
40
  end
26
41
 
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module InsertMany
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-insert_many
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Booth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-01-06 00:00:00.000000000 Z
12
+ date: 2016-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '5.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '5.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.4.8
93
+ rubygems_version: 2.5.1
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Adds a method for bulk-inserted records using ActiveRecord