-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fix rails7 default scope issue with select #582
Conversation
Currently this PR causes some issues in our rspec tests: expected ActiveRecord::RecordNotFound, got #<NoMethodError: undefined method `[]=' for nil:NilClass> with backtrace:
# /Users/ghost/Sites/mobility/lib/mobility/backends/active_record/pg_hash.rb:26:in `write'
# /Users/ghost/Sites/mobility/lib/mobility/plugins/cache.rb:78:in `write'
# /Users/ghost/Sites/mobility/lib/mobility/plugins/writer.rb:29:in `name='
# /Users/ghost/Sites/mobility/lib/mobility/plugins/locale_accessors.rb:68:in `public_send'
# /Users/ghost/Sites/mobility/lib/mobility/plugins/locale_accessors.rb:68:in `name_en=' |
I'd really like to reproduce the issue here before shipping a fix. There's already a regression spec for #513 that runs on Rails 7: mobility/spec/mobility/plugins/active_record/query_spec.rb Lines 157 to 194 in b342074
It is passing so I'm not sure what's happening in your case. I don't doubt you're seeing the error but if the spec is not testing the problem correctly I'd like to fix that too. |
Also:
I assume you mean:
right? ( |
Ah I got it by adding a test with
I'll ship this with your fix. |
That doesn't look related to anything here. |
A fix for this was released in 1.2, closing this. Thanks for the issue report and fix! |
@shioyama awesome! ❤️ |
We did not investigate too much but after upgrading to rails 7 we had issues when using
default_scope { I18n }
coupled with active record select method.This PR seems to fix it but feel free to change and or add tests for other use cases.
This seems to fix issues described in #513 back in the days