Change Base#update to accept attributes
#447
Merged
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.
If the intent of Active Resource to be similar enough to Active Record for its users to be able to intuit its interfaces, the absence of
Base#updatecan is a surprise.Prior to this commit, the was an existent
Base#updateprotected method that handles issuing thePUTrequest. Its interface is more akin toBase#save, in that it did not accept attributes.This commit foists that method from being
protectedto bepublic. It changes the interface to accept attributes. It retains the original implementation when theattributesargument is omitted (for the sake of backwards compatibility). Whenattributesare provided, forward them to theBase#update_attributesmethod. Explicitly document the interface that indicates that the only way for public callers to invoke the method if with anattributesargument.This commit also implements the
Base#update_attributemethod in terms of theBase#update_attributesmethod.