Skip to content

Commit 75df197

Browse files
authored
Merge pull request #2 from hoverinc/include-blobs
auto include blob association for active storage attachments
2 parents 2e029ed + b344dfa commit 75df197

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
graphql-eager_loader (0.2.0)
4+
graphql-eager_loader (0.2.1)
55

66
GEM
77
remote: https://rubygems.org/

lib/graphql/eager_loader/builder.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def initialize(selection:, model:)
4949
end
5050

5151
def includes
52-
self.class.call(selections: selection.selections, model: includes_model)
52+
hash = {}
53+
hash[:blob] = {} if active_storage_attachment?
54+
hash.merge self.class.call(selections: selection.selections, model: includes_model)
5355
end
5456

5557
def association?

lib/graphql/eager_loader/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Graphql
44
module EagerLoader
5-
VERSION = '0.2.0'
5+
VERSION = '0.2.1'
66
end
77
end

spec/graphql/eager_loader_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
expect(options).to eq(
9292
proposal_documents: {},
9393
jobs: { user: {} },
94-
photo_attachment: {}
94+
photo_attachment: { blob: {} }
9595
)
9696
end
9797
end

0 commit comments

Comments
 (0)