Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Comments

prevent quoted null when to_json is called on nil relationship#41

Open
soopa wants to merge 1 commit intodatamapper:release-1.2from
soopa:release-1.2
Open

prevent quoted null when to_json is called on nil relationship#41
soopa wants to merge 1 commit intodatamapper:release-1.2from
soopa:release-1.2

Conversation

@soopa
Copy link

@soopa soopa commented Sep 25, 2013

This is an update to #23 from 2011 to target the release-1.2 branch rather than master given the divergence of those two branches, and abandonment of master. The impact and code change is the same as before…


Fixes the case where calling something like:

resource.to_json(:relationships => { :nested_resource => { :only => [:id] } })

When the nested resource returns nil, would return invalid JSON like…

{
  "id":1,
  "nested_resouce":"null"
}

Rather than valid JSON like…

{
  "id":1,
  "nested_resouce":null
}

(Note the quotes around null)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant