Skip to content

Commit

Permalink
Merge pull request #99 from tymate/fix-has-many-duplicates
Browse files Browse the repository at this point in the history
fix: duplicate records rendered on has many association
  • Loading branch information
pauldub authored Jan 21, 2021
2 parents f24e7ce + dbf5940 commit dc88a50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
api-blocks (0.8.0)
api-blocks (0.9.0)
activesupport (>= 5.1.0)
dry-configurable (~> 0.8)
dry-monads (~> 1.3)
Expand Down Expand Up @@ -101,10 +101,9 @@ GEM
dry-equalizer (~> 0.2)
dry-inflector (0.2.0)
dry-initializer (3.0.4)
dry-logic (1.0.8)
dry-logic (1.1.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-core (~> 0.5, >= 0.5)
dry-matcher (0.8.3)
dry-core (>= 0.4.8)
dry-monads (1.3.5)
Expand Down
1 change: 1 addition & 0 deletions lib/api_blocks/blueprinter/association_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def extract(association_name, object, local_options, options = {})
model.where(join_key.key => ids).merge(scope).each do |record|
loader.call(record.send(join_key.key)) do |memo|
memo << render_blueprint(record, local_options, options)
memo.uniq
end
end
when ActiveRecord::Associations::HasOneAssociation
Expand Down
2 changes: 1 addition & 1 deletion lib/api_blocks/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module ApiBlocks
# Current version of ApiBlocks
VERSION = '0.8.0'
VERSION = '0.9.0'
end

0 comments on commit dc88a50

Please sign in to comment.