Add find_by_alternate_identifier, for #207#419
Merged
tpendragon merged 3 commits intomasterfrom Mar 27, 2018
Merged
Conversation
Collaborator
|
@stkenny Is this still a WIP? |
Contributor
Author
|
I think the fedora adaptor needs to delete the extra created resource in delete. |
582885f to
9dc37e0
Compare
9dc37e0 to
4ffd7e1
Compare
tpendragon
requested changes
Mar 26, 2018
Collaborator
tpendragon
left a comment
There was a problem hiding this comment.
Really small change, but then this looks great! No data migrations necessary too!
|
|
||
| def ensure_multiple_values!(resource) | ||
| bad_keys = resource.attributes.except(:internal_resource, :created_at, :updated_at, :new_record, :id).select do |_k, v| | ||
| bad_keys = resource.attributes.except(:internal_resource, :created_at, :updated_at, :new_record, :id, :alternate_identifier).select do |_k, v| |
Collaborator
There was a problem hiding this comment.
Don't have to add this anymore right? The special value is alternate_ids
tpendragon
reviewed
Mar 26, 2018
|
|
||
| def ensure_multiple_values!(resource) | ||
| bad_keys = resource.attributes.except(:internal_resource, :created_at, :updated_at, :new_record, :id).select do |_k, v| | ||
| bad_keys = resource.attributes.except(:internal_resource, :created_at, :updated_at, :new_record, :id, :alternate_identifier).select do |_k, v| |
Collaborator
There was a problem hiding this comment.
Same thing here - not necessary anymore.
tpendragon
reviewed
Mar 26, 2018
| orm_class.find_or_initialize_by(id: resource.id && resource.id.to_s).tap do |orm_object| | ||
| orm_object.internal_resource = resource.internal_resource | ||
| orm_object.metadata.merge!(resource.attributes.except(:id, :internal_resource, :created_at, :updated_at)) | ||
| orm_object.alternate_identifier = resource.alternate_identifier if resource.respond_to?(:alternate_identifier) |
Collaborator
There was a problem hiding this comment.
I don't think these are necessary anymore either.
tpendragon
approved these changes
Mar 27, 2018
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.
Test based on success criteria pass for all adapters.