We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When the delete command is defined in a repository together with the timestamps plugin, I get the following error by deleting a record:
delete
wrong number of arguments (given 1, expected 2+) (ArgumentError)
It might be linked to #475
require 'bundler/inline' gemfile(install: true) do source 'http://rubygems.org' gem 'rom' gem 'rom-sql' gem 'sqlite3' end class Users < ROM::Relation[:sql] schema(infer: true) end class UserRepository < ROM::Repository[:users] commands :create, update: :by_pk, delete: :by_pk, use: :timestamps, plugins_options: { timestamps: { timestamps: %i[created_at updated_at] } } end rom = ROM.container(:sql, 'sqlite::memory') do |conf| conf.default.create_table :users do primary_key :id column :name, String, null: false column :created_at, DateTime, null: false column :updated_at, DateTime, null: false end conf.register_relation(Users) end repo = UserRepository.new(rom) user = repo.create(name: 'New User') p user p repo.delete(user.id) # output: # #<ROM::Struct::User id=1 name="New User" created_at=2022-02-28 07:25:30 +0100 updated_at=2022-02-28 07:25:30 +0100> # /Users/gianpieroaddis/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rom-core-5.2.6/lib/rom/command.rb:475:in `apply_hooks': wrong number of arguments (given 1, expected 2+) (ArgumentError) # from /Users/gianpieroaddis/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rom-core-5.2.6/lib/rom/command.rb:277:in `call' # from /Users/gianpieroaddis/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rom-sql-3.5.0/lib/rom/sql/commands/error_wrapper.rb:18:in `call' # from /Users/gianpieroaddis/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rom-core-5.2.6/lib/rom/commands/composite.rb:19:in `call' # from /Users/gianpieroaddis/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rom-repository-5.2.2/lib/rom/repository/class_interface.rb:153:in `block (2 levels) in define_restricted_command_method' # from rom.rb:43:in `<main>'
repo.delete(user.id) should only expect one argument.
repo.delete(user.id)
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
When the
delete
command is defined in a repository together with the timestamps plugin, I get the following error by deleting a record:It might be linked to #475
To Reproduce
Expected behavior
repo.delete(user.id)
should only expect one argument.My environment
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
The text was updated successfully, but these errors were encountered: