The record_count method seen below references @context, but that attribute does not appear to be set anywhere. As a result, trying to narrow results with a custom self.records in a resource results in a variety of nil-does-not-have-that-method style errors.
https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/operation.rb#L26-L30
def record_count
@_record_count ||= @resource_klass.find_count(@resource_klass.verify_filters(@filters, @context),
context: @context,
include_directives: @include_directives)
end
This seems to impact top level links and pagination totals.
As a quick patch, I set @context in a patch included in an initializer:
module JSONAPIFindOperationPatch
def apply(context)
@context = context
super
end
end
module JSONAPI
class FindOperation
prepend JSONAPIFindOperationPatch
end
end
v0.4.0 does not appear to to have this issue with misplaced context. If I am missing something obvious, let me know!
The
record_countmethod seen below references@context, but that attribute does not appear to be set anywhere. As a result, trying to narrow results with a customself.recordsin a resource results in a variety of nil-does-not-have-that-method style errors.https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/operation.rb#L26-L30
This seems to impact top level links and pagination totals.
As a quick patch, I set
@contextin a patch included in an initializer:v0.4.0 does not appear to to have this issue with misplaced context. If I am missing something obvious, let me know!