prevent quoted nulls ("null") when to_json is called on nil relationship #23

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant

soopa commented Oct 21, 2011

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)

soopa commented Nov 7, 2011

Acceptable?

soopa commented Sep 25, 2013

Checking in, 2 years later. I've just rebased this cleanly on latest master and the build is passing.

@solnic @dkubb could one of your merge this please? I'd love to get the reference to my fork out of my Gemfile and resolve this issue for anyone else who may be stumbling upon it.

Thanks!

soopa commented Sep 25, 2013

Updated branch target in #41, closing this one.

@soopa soopa closed this Sep 25, 2013

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