module JSONAPI::Record::Updatable

Public Class Methods

included(base) click to toggle source
# File lib/jsonapi/record/updatable.rb, line 6
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

payload_attributes() click to toggle source

Override payload_attributes

# File lib/jsonapi/record/updatable.rb, line 48
def payload_attributes
  payload_attributes_for_update
end
payload_attributes_for_update() click to toggle source

Returns the attributes for the payload for patch request. @return [Hash] if there are updatable attributes. @return [nil] if there are no updatable attributes.

# File lib/jsonapi/record/updatable.rb, line 55
def payload_attributes_for_update
  updatable_attributes if updatable_attributes.any?
end
updatable_attributes() click to toggle source

Returns the attributes for updating a resource. @return [Hash]

# File lib/jsonapi/record/updatable.rb, line 43
def updatable_attributes
  attributes.slice(*self.class.updatable_attribute_names)
end