app/controllers/api/abstract_controller.rb
def stale_data?
      if resource
        updated_at = raw_json[:updated_at]
        if updated_at
          if resource.updated_at.as_json != updated_at
            # Allow row lock violations,
            # but only if the violation
            # changes 1 fields or less.
            # Changing more than one column
            # with an invalid `updated_at`
            # field is not allowed.
            diff_count = 0
            raw_json
              .except(*IRRELEVANT_ROW_LOCK_FIELDS)
              .slice(*resource.class.column_names.map(&:to_sym))
              .to_a
              .each do |(key, value)|
              if resource[key] != raw_json[key]
                diff_count += 1
              end
            end
            return true if diff_count > 1
          end
        end
      end
      return false
    end
# This error is thrown when you try to use a non-JSON request body on an
# endpoint that requires JSON.
This error is thrown when you try to use a non-JSON request body on an
endpoint that requires JSON.
This error is thrown when you try to use a non - JSON request body on an endpoint that requires JSON .
def stale_data?
      if resource
        updated_at = raw_json[:updated_at]
        if updated_at
          if resource.updated_at.as_json != updated_at
            diff_count = 0
            raw_json
              .except(*IRRELEVANT_ROW_LOCK_FIELDS)
              .slice(*resource.class.column_names.map(&:to_sym))
              .to_a
              .each do |(key, value)|
              if resource[key] != raw_json[key]
                diff_count += 1
              end
            end
            return true if diff_count > 1
          end
        end
      end
      return false
    end
def stale_data? if resource updated_at = raw_json [ :updated_at ] if updated_at if resource . updated_at . as_json != updated_at diff_count = 0 raw_json . except ( * IRRELEVANT_ROW_LOCK_FIELDS ) . slice ( * resource . class . column_names . map ( & :to_sym ) ) . to_a . each do | ( key , value ) | if resource [ key ] != raw_json [ key ] diff_count += 1 end end return true if diff_count > 1 end end end return false end
This error is thrown when you try to use a non-JSON request body on an
endpoint that requires JSON.
This error is thrown when you try to use a non - JSON request body on an endpoint that requires JSON .
# Allow row lock violations, # but only if the violation # changes 1 fields or less. # Changing more than one column # with an invalid `updated_at` # field is not allowed.