-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
create returns nil for custom primary keys #389
Comments
I'm working on various improvements in the command API in rom 6.0 that will be reflected in rom-sql 4.0 and so I'll address this issue as part of this work. |
Test in rom 5.0, when primary key isn't integer it always return |
I use rom-sql/lib/rom/sql/commands/create.rb Lines 47 to 50 in 4fe989e
The The tracepoint usage: trace = TracePoint.new(:return) { |tp| pp [tp, tp.path, tp.method_id]; tp.binding.pry if tp.path.include?('commands/create.rb') }; trace.enable { UserRepository.new.create(name: 'Aotoki') } Add def insert(*args, &block)
dataset.returning(primary_key).insert(*args, &block).map { |hash| hash[primary_key] }
end
|
I too am having this issue trying to work with a number of tables with non-numeric primary keys. Are there any updates on this? Any workarounds? |
Describe the bug
When using a randomly generated string as a primary key,
create
returnsnil
.To Reproduce
Expected behavior
create
should return the record that was created.My environment
The text was updated successfully, but these errors were encountered: