Skip to content

Handle insert returning using symbol #1226

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

Merged
merged 6 commits into from
Sep 29, 2024
Merged

Conversation

aidanharan
Copy link
Contributor

@aidanharan aidanharan commented Sep 27, 2024

Support using symbol for returning. Eg: Book.insert!({ name: book_name }, returning: :id).

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/actions/runs/11072196039/job/30765857801

 1) Error:
InsertAllTest#test_insert_with_type_casting_and_serialize_is_consistent:
NoMethodError: undefined method `map' for :id:Symbol
    lib/active_record/connection_adapters/sqlserver/database_statements.rb:148:in `build_insert_sql'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/insert_all.rb:193:in `to_sql'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/insert_all.rb:54:in `execute'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/insert_all.rb:13:in `block in execute'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:388:in `with_connection'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/insert_all.rb:12:in `execute'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/relation.rb:784:in `insert_all!'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/relation.rb:727:in `insert!'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/lib/active_record/querying.rb:24:in `insert!'
    /usr/local/bundle/bundler/gems/rails-13d5f8720892/activerecord/test/cases/insert_all_test.rb:55:in `test_insert_with_type_casting_and_serialize_is_consistent'

Support using symbol for returning. Eg: "Book.insert!({ name: book_name }, returning: :id)"
@aidanharan aidanharan marked this pull request as ready for review September 29, 2024 11:41
@aidanharan aidanharan merged commit 8bd31c2 into main Sep 29, 2024
4 checks passed
@aidanharan aidanharan deleted the insert-returning-symbols branch September 29, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant