Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating an array of relations only returns first saved element #561

Open
mlk5060 opened this issue Aug 6, 2019 · 2 comments
Open

Creating an array of relations only returns first saved element #561

mlk5060 opened this issue Aug 6, 2019 · 2 comments

Comments

@mlk5060
Copy link

mlk5060 commented Aug 6, 2019

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

  1. Create a new class that inherits from ROM::Repository
  2. Add the commands :create macro to this class
  3. Attempt to save an array of hashes that represent the relation which the ROM::Repository defined in step 1 handles.
  4. 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
@mlk5060 mlk5060 added the bug label Aug 6, 2019
@solnic solnic added this to the 6.0.0 milestone Jan 2, 2020
@solnic
Copy link
Member

solnic commented Jan 2, 2020

For the record, this is happening because the underlying changeset command is configured using result: :one option

@mlk5060
Copy link
Author

mlk5060 commented Jan 3, 2020

Thanks for the clarification @solnic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants