protected_attributes_continued 1.8.0 → 1.8.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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e881236bacf8378d98f06eb98269417a5082383de65360f522e524062fbcdfb
|
4
|
+
data.tar.gz: 45f598ce1954ed9542934e676af3ac8f53e6b5c6dea2c35e87b3100721d2522a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30fb108c2db47feeb17c7787dc1427a44e93b7ac47450d79f20d59a3bf814d3f8314eb42ee71a76bd3e1f54dbec508d56e917ab0f57d5a6c7c7e5a68a4ac2d8d
|
7
|
+
data.tar.gz: '0486645654d15f177a2ba9abd27069c598b9d08884a7beb4db9d7813ce79604265d0eab9263f937aa0957c963cbd66dc435d4628993381793789068d04d0573b'
|
@@ -5,29 +5,41 @@ module ActiveRecord
|
|
5
5
|
undef :create!
|
6
6
|
|
7
7
|
def build(attributes = nil, options = {}, &block)
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
@association.build(attributes, options, &block)
|
12
|
-
end
|
8
|
+
block = protected_attributes_scope_block('new', block)
|
9
|
+
scoping { @association.build(attributes, options, &block) }
|
13
10
|
end
|
14
11
|
alias new build
|
15
12
|
|
16
13
|
def create(attributes = nil, options = {}, &block)
|
17
|
-
|
18
|
-
|
19
|
-
else
|
20
|
-
@association.create(attributes, options, &block)
|
21
|
-
end
|
14
|
+
block = protected_attributes_scope_block('create', block)
|
15
|
+
scoping { @association.create(attributes, options, &block) }
|
22
16
|
end
|
23
17
|
|
24
18
|
def create!(attributes = nil, options = {}, &block)
|
25
|
-
|
26
|
-
|
27
|
-
else
|
28
|
-
@association.create!(attributes, options, &block)
|
29
|
-
end
|
19
|
+
block = protected_attributes_scope_block('create!', block)
|
20
|
+
scoping { @association.create!(attributes, options, &block) }
|
30
21
|
end
|
31
22
|
|
23
|
+
private
|
24
|
+
|
25
|
+
if ActiveRecord.gem_version < Gem::Version.new('6.0')
|
26
|
+
|
27
|
+
def protected_attributes_scope_block(_label, block)
|
28
|
+
block
|
29
|
+
end
|
30
|
+
|
31
|
+
elsif ActiveRecord.gem_version < Gem::Version.new('6.1')
|
32
|
+
|
33
|
+
def protected_attributes_scope_block(label, block)
|
34
|
+
_deprecated_scope_block(label, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
else
|
38
|
+
|
39
|
+
def protected_attributes_scope_block(_label, block)
|
40
|
+
current_scope_restoring_block(&block)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
32
44
|
end
|
33
45
|
end
|
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.1
|
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-03-
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|