JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
ResourceSerializer serialized hash is nil
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Just updated to rails 5.
In a controller test, using minitest:
#From factory girl
user = create(:user)
resource = UserResource.new(user), nil)
serializer = JSONAPI::ResourceSerializer.new(UserResource)
output = serializer.serialize_to_hash(resource)
The resource is:
p resource
#<UserResource:0x0055ba82bd2170
@model=#<User id: nil, name: "Mitchell-Gerhold">,
@context=nil,
@reload_needed=false,
@changing=false,
@save_needed=false>
But the serialized output is:
p output
{
:data => nil
}
Any ideas?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the controller example and tracing JSONAPI::ResourceSerializer#serialize_to_hash with the shown UserResource state. Compare the resource's model and serializer input with the expected output, then verify that a regression check covers the nil :data result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100