module JSONAPI::Record::Updatable::ClassMethods
Public Instance Methods
updatable_attribute_names()
click to toggle source
Allows to override the attributes for updating a resource. @return [Array<Symbol>]
# File lib/jsonapi/record/updatable.rb, line 36 def updatable_attribute_names resource_attribute_names end
update(record)
click to toggle source
@param record [JSONAPI::Record::Base] @return [JSONAPI::Record::Base]
# File lib/jsonapi/record/updatable.rb, line 13 def update(record) response_document = JSONAPI::SimpleClient.update( individual_uri(record.id), default_headers, record.to_payload ) case response_document when Types::Success, Types::Failure record.new(parse(response_document)) when Types::Document record.new(persisted: true) end end
update!(record)
click to toggle source
@param record [JSONAPI::Record::Base] @raise [JSONAPI::SimpleClient::UnprocessableEntity] if update fails. @return [JSONAPI::Record::Base]
# File lib/jsonapi/record/updatable.rb, line 30 def update!(record) raise_exception_when_errors { update(record) } end