Creating an array of relations only returns first saved element
mlk5060 opened this issue · 2 comments
Describe the bug
After following the repository quick start guide, specifically the create sub-section, I attempted to pass an array of hashes to the exposed create
method on the repository. All array elements were saved to the datasource, but only the first saved element was returned.
To Reproduce
- Create a new class that inherits from
ROM::Repository
- Add the
commands :create
macro to this class - Attempt to save an array of hashes that represent the relation which the
ROM::Repository
defined in step 1 handles. - Inspect the underlying datasource and return value of
create
Expected behavior
Providing that no elements in the input array violate the underlying datasources constraints, all input array elements should be saved in the underlying datasource, and the return value of create
should be an array whose size is equal to the input array, and contain representations of each tuple saved in the underlying datasource
Your environment
- Affects my production application: NO
- Ruby version: 2.6.3
- OS: Ubuntu 16.04/18.04
- Gemfile:
source "https://rubygems.org"
gem "rake"
# Web framework
gem "dry-system", "~> 0.9"
gem "dry-web", "~> 0.7"
gem "dry-web-roda", "~> 0.11"
gem "puma"
gem "rack_csrf"
gem "rack", ">= 2.0"
# Database persistence
gem "pg"
gem "rom", "~> 5.1"
gem "rom-sql", "~> 3.0.1"
# Application dependencies
gem "dry-matcher", "~> 0.8"
gem "dry-monads", "~> 1.3.0"
gem "dry-struct", "~> 1.0"
gem "dry-transaction", "~> 0.13"
gem "dry-types", "~> 1"
gem "dry-validation", "~> 1.2.1"
gem "dry-view", "~> 0.7"
gem "slim"
group :development, :test do
gem "pry-byebug", platform: :mri
end
group :development do
gem "rerun"
end
group :test do
gem "capybara"
gem "capybara-screenshot"
gem "database_cleaner"
gem "poltergeist"
gem "rspec"
gem "rom-factory", "~> 0.5"
end
For the record, this is happening because the underlying changeset command is configured using result: :one
option