Support through_association with singleton.#878
Open
cgunther wants to merge 1 commit into
Open
Conversation
aca0509 to
aad91da
Compare
Given a load declaration like: ```ruby load_resource :order load_resource through: :address, through_association: :custom_address, singleton: true ``` The `:through_assocation` option wasn't being respected in the `:singleton` branch, thus falling back to calling `find`, but odds are you wouldn't have an ID given it was a singleton, thus leading to an error. Now it uses the `:through_association` before falling back to the `name`. Fixes CanCanCommunity#604.
aad91da to
208a24f
Compare
Contributor
Author
|
CI seems to be failing against ActiveRecord main due to bumping to sqlite3 v2 in Rails 8.0 but the gemfile is using v1.7: It's also failing against ActiveRecord v6.0, v6.1, and v7.0 due to a change in concurrent-ruby where it stopped requiring the logger gem, but ActiveSupport was relying on it to require logger. This was fixed in v7.1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Given a load declaration like:
The
:through_assocationoption wasn't being respected in the:singletonbranch, thus falling back to callingfind, but odds are you wouldn't have an ID given it was a singleton, thus leading to an error.Now it uses the
:through_associationbefore falling back to thename.Fixes #604.