protected_attributes_continued 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86d47e2aa9219271973c37cb944a3b5722c1d9667718eee090fbf3fe4df2c1de
|
4
|
+
data.tar.gz: c548ba06b3f2f884b2e6ec4e7ef8252755af23c837c2394d9212a9858e8334e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a4ee291ffbd2be19f45ddbee0bdd1b2b489bee22a4298399f814e140094551846bbf50cd4ac481c0ded209f8a80fa0cffb8d1c75c9d73c471d2eae00a133f2
|
7
|
+
data.tar.gz: c86f600a36c43204c193fd10558f7808857f578c4edbe3cf7af6425be7c7ba7ccc41c65c113305404f8dc18a90576550e66e605cc32185865f0642bd56053d8c
|
@@ -55,6 +55,18 @@ module ActiveRecord
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
private :create_record
|
58
|
+
|
59
|
+
if ActiveRecord.version >= Gem::Version.new("6.0.4") && ActiveRecord.version < Gem::Version.new("6.1")
|
60
|
+
undef :build_record
|
61
|
+
|
62
|
+
def build_record(attributes, options)
|
63
|
+
previous = klass.current_scope(true) if block_given?
|
64
|
+
super
|
65
|
+
ensure
|
66
|
+
klass.current_scope = previous if previous
|
67
|
+
end
|
68
|
+
private :build_record
|
69
|
+
end
|
58
70
|
end
|
59
71
|
|
60
72
|
class CollectionProxy
|
@@ -92,7 +104,23 @@ module ActiveRecord
|
|
92
104
|
end
|
93
105
|
|
94
106
|
class HasManyThroughAssociation
|
95
|
-
if ActiveRecord.version >= Gem::Version.new('
|
107
|
+
if ActiveRecord.version >= Gem::Version.new('6.1')
|
108
|
+
undef :build_through_record
|
109
|
+
def build_through_record(record)
|
110
|
+
@through_records[record] ||= begin
|
111
|
+
ensure_mutable
|
112
|
+
|
113
|
+
attributes = through_scope_attributes
|
114
|
+
attributes[source_reflection.name] = record
|
115
|
+
attributes[source_reflection.foreign_type] = options[:source_type] if options[:source_type]
|
116
|
+
|
117
|
+
# Pass in `without_protection: true` here because `options_for_through_record`
|
118
|
+
# was removed in https://github.com/rails/rails/pull/35799
|
119
|
+
through_association.build(attributes, without_protection: true)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
private :build_through_record
|
123
|
+
elsif ActiveRecord.version >= Gem::Version.new('5.2.3')
|
96
124
|
undef :build_through_record
|
97
125
|
def build_through_record(record)
|
98
126
|
@through_records[record.object_id] ||= begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protected_attributes_continued
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.1.
|
144
|
+
rubygems_version: 3.1.4
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Protect attributes from mass assignment in Active Record models
|