clone_kit 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/clone_kit/cloners/active_record_ruleset_cloner.rb +17 -3
- data/lib/clone_kit/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1837ffa6f7b44a9d3c4e39fd6fd2a50c310c7033c1a6ba5b35de06dee51aa638
|
4
|
+
data.tar.gz: 7fcf54af416183ea480ac13305bd593e7fe9994ffad5170d81508b181bce130e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d46e6443528061c6cc878f441f969ee64edd5d60da68025a28868e9c69079c3a20a49aec85e6afe346ff98e6319e792a43cf1f294f87d502dcad4913cc4cfce
|
7
|
+
data.tar.gz: 0e637ab67b7375b4705482bc8beca5372228d5c3e99fa7dfdfecb349623dfb2ebf8c1c836475a5544f45ab8e12f09991cc9b36efa5590170b88f6611f5efdf33
|
@@ -75,9 +75,7 @@ module CloneKit
|
|
75
75
|
|
76
76
|
def insert(model)
|
77
77
|
insert_op = model.class.arel_table.create_insert.tap do |insert_mgr|
|
78
|
-
insert_mgr.insert(
|
79
|
-
model.send(:arel_attributes_with_values_for_create, model.attribute_names)
|
80
|
-
)
|
78
|
+
insert_mgr.insert(arel_attributes_with_values_for_create(model))
|
81
79
|
end
|
82
80
|
|
83
81
|
connection.execute(insert_op.to_sql)
|
@@ -104,6 +102,22 @@ module CloneKit
|
|
104
102
|
def connection
|
105
103
|
ActiveRecord::Base.connection
|
106
104
|
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
# This method has been deprecated in rails 5.2 (https://github.com/rails/rails/commit/2f45157f2ebbe4f3fa43d3998b459c8eb9ec2b89)
|
109
|
+
# Workarounds to this method started to fail other parts of the code base. Hence I am defining it here.
|
110
|
+
def arel_attributes_with_values_for_create(model)
|
111
|
+
attrs = {}
|
112
|
+
arel_table = model.class.arel_table
|
113
|
+
attribute_names = model.send(:attributes_for_create, model.attribute_names)
|
114
|
+
|
115
|
+
attribute_names.each do |name|
|
116
|
+
attrs[arel_table[name]] = model.send(:_read_attribute, name)
|
117
|
+
end
|
118
|
+
|
119
|
+
attrs
|
120
|
+
end
|
107
121
|
end
|
108
122
|
end
|
109
123
|
end
|
data/lib/clone_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clone_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Croft
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -328,8 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
328
|
- !ruby/object:Gem::Version
|
329
329
|
version: '0'
|
330
330
|
requirements: []
|
331
|
-
|
332
|
-
rubygems_version: 2.6.14.4
|
331
|
+
rubygems_version: 3.2.3
|
333
332
|
signing_key:
|
334
333
|
specification_version: 4
|
335
334
|
summary: A toolkit to assist in complex cloning operations
|