@@ -61,10 +61,6 @@ module Attached::Model
61
61
# There is no column defined on the model side, Active Storage takes
62
62
# care of the mapping between your records and the attachment.
63
63
#
64
- # To avoid N+1 queries, you can include the attached blobs in your query like so:
65
- #
66
- # User.with_attached_avatar
67
- #
68
64
# Under the covers, this relationship is implemented as a +has_one+ association to a
69
65
# ActiveStorage::Attachment record and a +has_one-through+ association to a
70
66
# ActiveStorage::Blob record. These associations are available as +avatar_attachment+
@@ -94,6 +90,10 @@ module Attached::Model
94
90
# has_one_attached :avatar, service: ->(user) { user.in_europe_region? ? :s3_europe : :s3_usa }
95
91
# end
96
92
#
93
+ # To avoid N+1 queries, you can include the attached blobs in your query like so:
94
+ #
95
+ # User.with_attached_avatar
96
+ #
97
97
# If you need to enable +strict_loading+ to prevent lazy loading of attachment,
98
98
# pass the +:strict_loading+ option. You can do:
99
99
#
@@ -163,10 +163,6 @@ def #{name}=(attachable)
163
163
# There are no columns defined on the model side, Active Storage takes
164
164
# care of the mapping between your records and the attachments.
165
165
#
166
- # To avoid N+1 queries, you can include the attached blobs in your query like so:
167
- #
168
- # Gallery.where(user: Current.user).with_attached_photos
169
- #
170
166
# Under the covers, this relationship is implemented as a +has_many+ association to a
171
167
# ActiveStorage::Attachment record and a +has_many-through+ association to a
172
168
# ActiveStorage::Blob record. These associations are available as +photos_attachments+
@@ -196,6 +192,10 @@ def #{name}=(attachable)
196
192
# has_many_attached :photos, service: ->(gallery) { gallery.personal? ? :personal_s3 : :s3 }
197
193
# end
198
194
#
195
+ # To avoid N+1 queries, you can include the attached blobs in your query like so:
196
+ #
197
+ # Gallery.where(user: Current.user).with_attached_photos
198
+ #
199
199
# If you need to enable +strict_loading+ to prevent lazy loading of attachments,
200
200
# pass the +:strict_loading+ option. You can do:
201
201
#
0 commit comments