Serialized methods that return nil should not be considered YAML #492

Merged
merged 1 commit into from May 10, 2011

Projects

None yet

2 participants

@jaw6
Contributor
jaw6 commented May 10, 2011

(Rebased version of #200 (commits))

The way ActiveModel computes the type of serializable methods and attributes, any that return nil will be described as being YAML.

This produces XML like:

<person>
  <name>John Doe</name>
  <preferences type="yaml" nil="true"></preferences>
</person>

However, in many cases, the 'type="yaml"' part is unnecessary, and potentially misleading.

With this patch, the equivalent to the above XML would be:

<person>
  <name>John Doe</name>
  <preferences nil="true"></preferences>
</person>
@josevalim josevalim merged commit ceaf73a into rails:master May 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment