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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a507983839d97919215cefd37d745e7a0cdb1f77
4
- data.tar.gz: 5c5ad4a047aff295561b67c110a7e6cac3ace3c1
2
+ SHA256:
3
+ metadata.gz: 1837ffa6f7b44a9d3c4e39fd6fd2a50c310c7033c1a6ba5b35de06dee51aa638
4
+ data.tar.gz: 7fcf54af416183ea480ac13305bd593e7fe9994ffad5170d81508b181bce130e
5
5
  SHA512:
6
- metadata.gz: 81280583c44e89985b63c2da66e69551f54d946cdd06153f98c842541456ac52801480ce634a963e4572a6534f6cb1826d4137f384c51010008956eb7f17de3a
7
- data.tar.gz: 41606a0203376a83e017140286115613e5a663b682b5126d1ec33415290e3df12b73276df6a57246d3cc76a708f031bb3bbf6d75f023f1be073ddbbcdfc2d6da
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloneKit
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
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.0
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: 2019-12-16 00:00:00.000000000 Z
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
- rubyforge_project:
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