diff --git a/lib/jsonapi/utils/response/formatters.rb b/lib/jsonapi/utils/response/formatters.rb index f3d0db2..f8d3dde 100644 --- a/lib/jsonapi/utils/response/formatters.rb +++ b/lib/jsonapi/utils/response/formatters.rb @@ -22,7 +22,7 @@ def jsonapi_format_errors(data) private def active_record_obj?(data) - data.is_a?(ActiveRecord::Base)|| data.singleton_class.include?(ActiveModel::Model) + defined?(ActiveRecord::Base) && (data.is_a?(ActiveRecord::Base) || data.singleton_class.include?(ActiveModel::Model)) end def build_response_document(records, options)