activestorage 6.1.0.rc1 → 6.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activestorage might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b5828c669886bb3073bc9a325644f70785b9e7432fe34bf609369ae854472d1
4
- data.tar.gz: c20c99725925af7c67f86c4ad99fcc5add79a4c373db3c1d5ae6fe4c2b1a893b
3
+ metadata.gz: '0899559a3bc6de6d857ebb86597fab1354a02ae06697d643f689dcd763c688c1'
4
+ data.tar.gz: edbc9a4f7a25b9bd92f6bec1dca219b49df78c26fb774e0c4097dd59430f95f1
5
5
  SHA512:
6
- metadata.gz: 7d0adc41784932bd392d92f120fadea916633ccf659a2b2d5d3b6a305eee2ca093a6d82045e322b40a5d6349cfeae880db08c87f1972bb40e954f52dd1457c45
7
- data.tar.gz: adf193c0617237b63aaf251b0e0fe8ec0e48da5b3dc47d8a6e60a5b91ea976d3a205dd990a0a2b20d65bd21b70dc5eccbaed0a512a86c03445be84811fa5deda
6
+ metadata.gz: 257274e3e39b3af4dbab977180cc0357644171832a319d213fadefb24958b282a122001bb97890b2fffd8ec5124c03ca00e4fafd20f00bc33a2268595109db75
7
+ data.tar.gz: c4a122be03c4f7b513dc5d3dc5f229bbaef056af48e250133cfd250be2481ea22c864dded8f0668ef0da6a97e99c8061c837e21fafb0127840095d5bd7dfdd49
@@ -1,3 +1,9 @@
1
+ ## Rails 6.1.0.rc2 (December 01, 2020) ##
2
+
3
+ * Implement `strict_loading` on ActiveStorage associations.
4
+
5
+ *David Angulo*
6
+
1
7
  ## Rails 6.1.0.rc1 (November 02, 2020) ##
2
8
 
3
9
  * Remove deprecated support to pass `:combine_options` operations to `ActiveStorage::Transformers::ImageProcessing`.
@@ -11,7 +11,7 @@ class ActiveStorage::DirectUploadsController < ActiveStorage::BaseController
11
11
 
12
12
  private
13
13
  def blob_args
14
- params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :metadata).to_h.symbolize_keys
14
+ params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys
15
15
  end
16
16
 
17
17
  def direct_upload_json(blob)
@@ -40,7 +40,14 @@ module ActiveStorage
40
40
  # has_one_attached :avatar, service: :s3
41
41
  # end
42
42
  #
43
- def has_one_attached(name, dependent: :purge_later, service: nil)
43
+ # If you need to enable +strict_loading+ to prevent lazy loading of attachment,
44
+ # pass the +:strict_loading+ option. You can do:
45
+ #
46
+ # class User < ApplicationRecord
47
+ # has_one_attached :avatar, strict_loading: true
48
+ # end
49
+ #
50
+ def has_one_attached(name, dependent: :purge_later, service: nil, strict_loading: false)
44
51
  validate_service_configuration(name, service)
45
52
 
46
53
  generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
@@ -60,8 +67,8 @@ module ActiveStorage
60
67
  end
61
68
  CODE
62
69
 
63
- has_one :"#{name}_attachment", -> { where(name: name) }, class_name: "ActiveStorage::Attachment", as: :record, inverse_of: :record, dependent: :destroy
64
- has_one :"#{name}_blob", through: :"#{name}_attachment", class_name: "ActiveStorage::Blob", source: :blob
70
+ has_one :"#{name}_attachment", -> { where(name: name) }, class_name: "ActiveStorage::Attachment", as: :record, inverse_of: :record, dependent: :destroy, strict_loading: strict_loading
71
+ has_one :"#{name}_blob", through: :"#{name}_attachment", class_name: "ActiveStorage::Blob", source: :blob, strict_loading: strict_loading
65
72
 
66
73
  scope :"with_attached_#{name}", -> { includes("#{name}_attachment": :blob) }
67
74
 
@@ -111,7 +118,14 @@ module ActiveStorage
111
118
  # has_many_attached :photos, service: :s3
112
119
  # end
113
120
  #
114
- def has_many_attached(name, dependent: :purge_later, service: nil)
121
+ # If you need to enable +strict_loading+ to prevent lazy loading of attachments,
122
+ # pass the +:strict_loading+ option. You can do:
123
+ #
124
+ # class Gallery < ApplicationRecord
125
+ # has_many_attached :photos, strict_loading: true
126
+ # end
127
+ #
128
+ def has_many_attached(name, dependent: :purge_later, service: nil, strict_loading: false)
115
129
  validate_service_configuration(name, service)
116
130
 
117
131
  generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
@@ -138,7 +152,7 @@ module ActiveStorage
138
152
  end
139
153
  CODE
140
154
 
141
- has_many :"#{name}_attachments", -> { where(name: name) }, as: :record, class_name: "ActiveStorage::Attachment", inverse_of: :record, dependent: :destroy do
155
+ has_many :"#{name}_attachments", -> { where(name: name) }, as: :record, class_name: "ActiveStorage::Attachment", inverse_of: :record, dependent: :destroy, strict_loading: strict_loading do
142
156
  def purge
143
157
  each(&:purge)
144
158
  reset
@@ -149,7 +163,7 @@ module ActiveStorage
149
163
  reset
150
164
  end
151
165
  end
152
- has_many :"#{name}_blobs", through: :"#{name}_attachments", class_name: "ActiveStorage::Blob", source: :blob
166
+ has_many :"#{name}_blobs", through: :"#{name}_attachments", class_name: "ActiveStorage::Blob", source: :blob, strict_loading: strict_loading
153
167
 
154
168
  scope :"with_attached_#{name}", -> { includes("#{name}_attachments": :blob) }
155
169
 
@@ -10,7 +10,7 @@ module ActiveStorage
10
10
  MAJOR = 6
11
11
  MINOR = 1
12
12
  TINY = 0
13
- PRE = "rc1"
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0.rc1
4
+ version: 6.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2020-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.1.0.rc1
19
+ version: 6.1.0.rc2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.1.0.rc1
26
+ version: 6.1.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 6.1.0.rc1
33
+ version: 6.1.0.rc2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 6.1.0.rc1
40
+ version: 6.1.0.rc2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activejob
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 6.1.0.rc1
47
+ version: 6.1.0.rc2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 6.1.0.rc1
54
+ version: 6.1.0.rc2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activerecord
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 6.1.0.rc1
61
+ version: 6.1.0.rc2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 6.1.0.rc1
68
+ version: 6.1.0.rc2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: marcel
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -187,10 +187,10 @@ licenses:
187
187
  - MIT
188
188
  metadata:
189
189
  bug_tracker_uri: https://github.com/rails/rails/issues
190
- changelog_uri: https://github.com/rails/rails/blob/v6.1.0.rc1/activestorage/CHANGELOG.md
191
- documentation_uri: https://api.rubyonrails.org/v6.1.0.rc1/
190
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.0.rc2/activestorage/CHANGELOG.md
191
+ documentation_uri: https://api.rubyonrails.org/v6.1.0.rc2/
192
192
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
193
- source_code_uri: https://github.com/rails/rails/tree/v6.1.0.rc1/activestorage
193
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.0.rc2/activestorage
194
194
  post_install_message:
195
195
  rdoc_options: []
196
196
  require_paths: